@@ -264,6 +264,175 @@ function transformOutputFormat<T extends MessageCreateParams | MessageCountToken
264264 } as T ;
265265}
266266
267+ /**
268+ * Token usage for an advisor sub-inference iteration.
269+ */
270+ export interface BetaAdvisorMessageIterationUsage {
271+ /**
272+ * Breakdown of cached tokens by TTL
273+ */
274+ cache_creation : BetaCacheCreation | null ;
275+
276+ /**
277+ * The number of input tokens used to create the cache entry.
278+ */
279+ cache_creation_input_tokens : number ;
280+
281+ /**
282+ * The number of input tokens read from the cache.
283+ */
284+ cache_read_input_tokens : number ;
285+
286+ /**
287+ * The number of input tokens which were used.
288+ */
289+ input_tokens : number ;
290+
291+ /**
292+ * The model that will complete your prompt.\n\nSee
293+ * [models](https://docs.anthropic.com/en/docs/models-overview) for additional
294+ * details and options.
295+ */
296+ model : MessagesAPI . Model ;
297+
298+ /**
299+ * The number of output tokens which were used.
300+ */
301+ output_tokens : number ;
302+
303+ /**
304+ * Usage for an advisor sub-inference iteration
305+ */
306+ type : 'advisor_message' ;
307+ }
308+
309+ export interface BetaAdvisorRedactedResultBlock {
310+ /**
311+ * Opaque blob containing the advisor's output. Round-trip verbatim; do not inspect
312+ * or modify.
313+ */
314+ encrypted_content : string ;
315+
316+ type : 'advisor_redacted_result' ;
317+ }
318+
319+ export interface BetaAdvisorRedactedResultBlockParam {
320+ /**
321+ * Opaque blob produced by a prior response; must be round-tripped verbatim.
322+ */
323+ encrypted_content : string ;
324+
325+ type : 'advisor_redacted_result' ;
326+ }
327+
328+ export interface BetaAdvisorResultBlock {
329+ text : string ;
330+
331+ type : 'advisor_result' ;
332+ }
333+
334+ export interface BetaAdvisorResultBlockParam {
335+ text : string ;
336+
337+ type : 'advisor_result' ;
338+ }
339+
340+ export interface BetaAdvisorTool20260301 {
341+ /**
342+ * The model that will complete your prompt.\n\nSee
343+ * [models](https://docs.anthropic.com/en/docs/models-overview) for additional
344+ * details and options.
345+ */
346+ model : MessagesAPI . Model ;
347+
348+ /**
349+ * Name of the tool.
350+ *
351+ * This is how the tool will be called by the model and in `tool_use` blocks.
352+ */
353+ name : 'advisor' ;
354+
355+ type : 'advisor_20260301' ;
356+
357+ allowed_callers ?: Array < 'direct' | 'code_execution_20250825' | 'code_execution_20260120' > ;
358+
359+ /**
360+ * Create a cache control breakpoint at this content block.
361+ */
362+ cache_control ?: BetaCacheControlEphemeral | null ;
363+
364+ /**
365+ * Caching for the advisor's own prompt. When set, each advisor call writes a cache
366+ * entry at the given TTL so subsequent calls in the same conversation read the
367+ * stable prefix. When omitted, the advisor prompt is not cached.
368+ */
369+ caching ?: BetaCacheControlEphemeral | null ;
370+
371+ /**
372+ * If true, tool will not be included in initial system prompt. Only loaded when
373+ * returned via tool_reference from tool search.
374+ */
375+ defer_loading ?: boolean ;
376+
377+ /**
378+ * Maximum number of times the tool can be used in the API request.
379+ */
380+ max_uses ?: number | null ;
381+
382+ /**
383+ * When true, guarantees schema validation on tool names and inputs
384+ */
385+ strict ?: boolean ;
386+ }
387+
388+ export interface BetaAdvisorToolResultBlock {
389+ content : BetaAdvisorToolResultError | BetaAdvisorResultBlock | BetaAdvisorRedactedResultBlock ;
390+
391+ tool_use_id : string ;
392+
393+ type : 'advisor_tool_result' ;
394+ }
395+
396+ export interface BetaAdvisorToolResultBlockParam {
397+ content :
398+ | BetaAdvisorToolResultErrorParam
399+ | BetaAdvisorResultBlockParam
400+ | BetaAdvisorRedactedResultBlockParam ;
401+
402+ tool_use_id : string ;
403+
404+ type : 'advisor_tool_result' ;
405+
406+ /**
407+ * Create a cache control breakpoint at this content block.
408+ */
409+ cache_control ?: BetaCacheControlEphemeral | null ;
410+ }
411+
412+ export interface BetaAdvisorToolResultError {
413+ error_code :
414+ | 'max_uses_exceeded'
415+ | 'prompt_too_long'
416+ | 'too_many_requests'
417+ | 'overloaded'
418+ | 'unavailable'
419+ | 'execution_time_exceeded' ;
420+
421+ type : 'advisor_tool_result_error' ;
422+ }
423+
424+ export interface BetaAdvisorToolResultErrorParam {
425+ error_code :
426+ | 'max_uses_exceeded'
427+ | 'prompt_too_long'
428+ | 'too_many_requests'
429+ | 'overloaded'
430+ | 'unavailable'
431+ | 'execution_time_exceeded' ;
432+
433+ type : 'advisor_tool_result_error' ;
434+ }
435+
267436export interface BetaAllThinkingTurns {
268437 type : 'all' ;
269438}
@@ -994,6 +1163,7 @@ export type BetaContentBlock =
9941163 | BetaServerToolUseBlock
9951164 | BetaWebSearchToolResultBlock
9961165 | BetaWebFetchToolResultBlock
1166+ | BetaAdvisorToolResultBlock
9971167 | BetaCodeExecutionToolResultBlock
9981168 | BetaBashCodeExecutionToolResultBlock
9991169 | BetaTextEditorCodeExecutionToolResultBlock
@@ -1018,6 +1188,7 @@ export type BetaContentBlockParam =
10181188 | BetaServerToolUseBlockParam
10191189 | BetaWebSearchToolResultBlockParam
10201190 | BetaWebFetchToolResultBlockParam
1191+ | BetaAdvisorToolResultBlockParam
10211192 | BetaCodeExecutionToolResultBlockParam
10221193 | BetaBashCodeExecutionToolResultBlockParam
10231194 | BetaTextEditorCodeExecutionToolResultBlockParam
@@ -1160,7 +1331,9 @@ export interface BetaInputTokensTrigger {
11601331 * - Calculate the true context window size from the last iteration
11611332 * - Understand token accumulation across server-side tool use loops
11621333 */
1163- export type BetaIterationsUsage = Array < BetaMessageIterationUsage | BetaCompactionIterationUsage > ;
1334+ export type BetaIterationsUsage = Array <
1335+ BetaMessageIterationUsage | BetaCompactionIterationUsage | BetaAdvisorMessageIterationUsage
1336+ > ;
11641337
11651338export interface BetaJSONOutputFormat {
11661339 /**
@@ -1696,6 +1869,7 @@ export interface BetaRawContentBlockStartEvent {
16961869 | BetaServerToolUseBlock
16971870 | BetaWebSearchToolResultBlock
16981871 | BetaWebFetchToolResultBlock
1872+ | BetaAdvisorToolResultBlock
16991873 | BetaCodeExecutionToolResultBlock
17001874 | BetaBashCodeExecutionToolResultBlock
17011875 | BetaTextEditorCodeExecutionToolResultBlock
@@ -1922,6 +2096,7 @@ export interface BetaServerToolUseBlock {
19222096 input : { [ key : string ] : unknown } ;
19232097
19242098 name :
2099+ | 'advisor'
19252100 | 'web_search'
19262101 | 'web_fetch'
19272102 | 'code_execution'
@@ -1944,6 +2119,7 @@ export interface BetaServerToolUseBlockParam {
19442119 input : unknown ;
19452120
19462121 name :
2122+ | 'advisor'
19472123 | 'web_search'
19482124 | 'web_fetch'
19492125 | 'code_execution'
@@ -2925,6 +3101,7 @@ export type BetaToolUnion =
29253101 | BetaWebSearchTool20260209
29263102 | BetaWebFetchTool20260209
29273103 | BetaWebFetchTool20260309
3104+ | BetaAdvisorTool20260301
29283105 | BetaToolSearchToolBm25_20251119
29293106 | BetaToolSearchToolRegex20251119
29303107 | BetaMCPToolset ;
@@ -4104,6 +4281,7 @@ export interface MessageCountTokensParams {
41044281 | BetaWebSearchTool20260209
41054282 | BetaWebFetchTool20260209
41064283 | BetaWebFetchTool20260309
4284+ | BetaAdvisorTool20260301
41074285 | BetaToolSearchToolBm25_20251119
41084286 | BetaToolSearchToolRegex20251119
41094287 | BetaMCPToolset
@@ -4125,6 +4303,16 @@ Messages.ToolError = ToolError;
41254303
41264304export declare namespace Messages {
41274305 export {
4306+ type BetaAdvisorMessageIterationUsage as BetaAdvisorMessageIterationUsage ,
4307+ type BetaAdvisorRedactedResultBlock as BetaAdvisorRedactedResultBlock ,
4308+ type BetaAdvisorRedactedResultBlockParam as BetaAdvisorRedactedResultBlockParam ,
4309+ type BetaAdvisorResultBlock as BetaAdvisorResultBlock ,
4310+ type BetaAdvisorResultBlockParam as BetaAdvisorResultBlockParam ,
4311+ type BetaAdvisorTool20260301 as BetaAdvisorTool20260301 ,
4312+ type BetaAdvisorToolResultBlock as BetaAdvisorToolResultBlock ,
4313+ type BetaAdvisorToolResultBlockParam as BetaAdvisorToolResultBlockParam ,
4314+ type BetaAdvisorToolResultError as BetaAdvisorToolResultError ,
4315+ type BetaAdvisorToolResultErrorParam as BetaAdvisorToolResultErrorParam ,
41284316 type BetaAllThinkingTurns as BetaAllThinkingTurns ,
41294317 type BetaBase64ImageSource as BetaBase64ImageSource ,
41304318 type BetaBase64PDFSource as BetaBase64PDFSource ,
0 commit comments