@google/genai 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/genai.d.ts CHANGED
@@ -66,6 +66,225 @@ export declare enum AdapterSize {
66
66
  ADAPTER_SIZE_THIRTY_TWO = "ADAPTER_SIZE_THIRTY_TWO"
67
67
  }
68
68
 
69
+ /**
70
+ * An agent definition for the CreateAgent API. This message is the target for
71
+ * annotation-parser-based JSON parsing. New format: { "id": "customer-sentinel",
72
+ * "base_agent": "", "system_instruction": "...", "base_environment": { "type":
73
+ * "remote", "sources": [...] }, "tools": [ {"type": "code_execution"} ] }
74
+ */
75
+ declare interface Agent {
76
+ /**
77
+ * The unique identifier for the agent.
78
+ */
79
+ id?: string;
80
+ /**
81
+ * The base agent to extend.
82
+ */
83
+ base_agent?: string;
84
+ /**
85
+ * The environment configuration for the agent.
86
+ */
87
+ base_environment?: string | InteractionsAPI.Environment;
88
+ /**
89
+ * Agent description for developers to quickly read and understand.
90
+ */
91
+ description?: string;
92
+ /**
93
+ * System instruction for the agent.
94
+ */
95
+ system_instruction?: string;
96
+ /**
97
+ * The tools available to the agent.
98
+ */
99
+ tools?: Array<Agent.CodeExecution | Agent.GoogleSearch | Agent.URLContext | Agent.MCPServer>;
100
+ }
101
+
102
+ declare namespace Agent {
103
+ /**
104
+ * A tool that can be used by the model to execute code.
105
+ */
106
+ interface CodeExecution {
107
+ type: 'code_execution';
108
+ }
109
+ /**
110
+ * A tool that can be used by the model to search Google.
111
+ */
112
+ interface GoogleSearch {
113
+ type: 'google_search';
114
+ /**
115
+ * The types of search grounding to enable.
116
+ */
117
+ search_types?: Array<'web_search' | 'image_search' | 'enterprise_web_search'>;
118
+ }
119
+ /**
120
+ * A tool that can be used by the model to fetch URL context.
121
+ */
122
+ interface URLContext {
123
+ type: 'url_context';
124
+ }
125
+ /**
126
+ * A MCPServer is a server that can be called by the model to perform actions.
127
+ */
128
+ interface MCPServer {
129
+ type: 'mcp_server';
130
+ /**
131
+ * The allowed tools.
132
+ */
133
+ allowed_tools?: Array<InteractionsAPI.AllowedTools>;
134
+ /**
135
+ * Optional: Fields for authentication headers, timeouts, etc., if needed.
136
+ */
137
+ headers?: {
138
+ [key: string]: string;
139
+ };
140
+ /**
141
+ * The name of the MCPServer.
142
+ */
143
+ name?: string;
144
+ /**
145
+ * The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"
146
+ */
147
+ url?: string;
148
+ }
149
+ }
150
+
151
+ declare interface AgentCreateParams {
152
+ /**
153
+ * Path param: Which version of the API to use.
154
+ */
155
+ api_version?: string;
156
+ /**
157
+ * Body param: The unique identifier for the agent.
158
+ */
159
+ id?: string;
160
+ /**
161
+ * Body param: The base agent to extend.
162
+ */
163
+ base_agent?: string;
164
+ /**
165
+ * Body param: The environment configuration for the agent.
166
+ */
167
+ base_environment?: string | InteractionsAPI.Environment;
168
+ /**
169
+ * Body param: Agent description for developers to quickly read and understand.
170
+ */
171
+ description?: string;
172
+ /**
173
+ * Body param: System instruction for the agent.
174
+ */
175
+ system_instruction?: string;
176
+ /**
177
+ * Body param: The tools available to the agent.
178
+ */
179
+ tools?: Array<AgentCreateParams.CodeExecution | AgentCreateParams.GoogleSearch | AgentCreateParams.URLContext | AgentCreateParams.MCPServer>;
180
+ }
181
+
182
+ declare namespace AgentCreateParams {
183
+ /**
184
+ * A tool that can be used by the model to execute code.
185
+ */
186
+ interface CodeExecution {
187
+ type: 'code_execution';
188
+ }
189
+ /**
190
+ * A tool that can be used by the model to search Google.
191
+ */
192
+ interface GoogleSearch {
193
+ type: 'google_search';
194
+ /**
195
+ * The types of search grounding to enable.
196
+ */
197
+ search_types?: Array<'web_search' | 'image_search' | 'enterprise_web_search'>;
198
+ }
199
+ /**
200
+ * A tool that can be used by the model to fetch URL context.
201
+ */
202
+ interface URLContext {
203
+ type: 'url_context';
204
+ }
205
+ /**
206
+ * A MCPServer is a server that can be called by the model to perform actions.
207
+ */
208
+ interface MCPServer {
209
+ type: 'mcp_server';
210
+ /**
211
+ * The allowed tools.
212
+ */
213
+ allowed_tools?: Array<InteractionsAPI.AllowedTools>;
214
+ /**
215
+ * Optional: Fields for authentication headers, timeouts, etc., if needed.
216
+ */
217
+ headers?: {
218
+ [key: string]: string;
219
+ };
220
+ /**
221
+ * The name of the MCPServer.
222
+ */
223
+ name?: string;
224
+ /**
225
+ * The full URL for the MCPServer endpoint. Example: "https://api.example.com/mcp"
226
+ */
227
+ url?: string;
228
+ }
229
+ }
230
+
231
+ declare interface AgentDeleteParams {
232
+ /**
233
+ * Which version of the API to use.
234
+ */
235
+ api_version?: string;
236
+ }
237
+
238
+ /**
239
+ * A generic empty message that you can re-use to avoid defining duplicated empty
240
+ * messages in your APIs. A typical example is to use it as the request or the
241
+ * response type of an API method. For instance:
242
+ *
243
+ * service Foo {
244
+ * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
245
+ * }
246
+ */
247
+ declare interface AgentDeleteResponse {
248
+ }
249
+
250
+ declare interface AgentGetParams {
251
+ /**
252
+ * Which version of the API to use.
253
+ */
254
+ api_version?: string;
255
+ }
256
+
257
+ declare interface AgentListParams {
258
+ /**
259
+ * Path param: Which version of the API to use.
260
+ */
261
+ api_version?: string;
262
+ /**
263
+ * Query param
264
+ */
265
+ pageSize?: number;
266
+ /**
267
+ * Query param
268
+ */
269
+ pageToken?: string;
270
+ /**
271
+ * Query param
272
+ */
273
+ parent?: string;
274
+ }
275
+
276
+ declare interface AgentListResponse {
277
+ agents?: Array<Agent>;
278
+ nextPageToken?: string;
279
+ }
280
+
281
+ export declare class Agents extends BaseAgents {
282
+ }
283
+
284
+ export declare namespace Agents {
285
+ export { type Agent as Agent, type AgentListResponse as AgentListResponse, type AgentDeleteResponse as AgentDeleteResponse, type AgentCreateParams as AgentCreateParams, type AgentListParams as AgentListParams, type AgentDeleteParams as AgentDeleteParams, type AgentGetParams as AgentGetParams, };
286
+ }
287
+
69
288
  /** Aggregation metric. This enum is not supported in Gemini API. */
70
289
  export declare enum AggregationMetric {
71
290
  /**
@@ -671,6 +890,26 @@ export declare interface AvatarConfig {
671
890
  declare class BadRequestError extends APIError<400, Headers> {
672
891
  }
673
892
 
893
+ declare class BaseAgents extends APIResource {
894
+ static readonly _key: readonly ['agents'];
895
+ /**
896
+ * Creates a new Agent (Typed version for SDK).
897
+ */
898
+ create(params?: AgentCreateParams | null | undefined, options?: RequestOptions): APIPromise<Agent>;
899
+ /**
900
+ * Lists all Agents.
901
+ */
902
+ list(params?: AgentListParams | null | undefined, options?: RequestOptions): APIPromise<AgentListResponse>;
903
+ /**
904
+ * Deletes an Agent.
905
+ */
906
+ delete(id: string, params?: AgentDeleteParams | null | undefined, options?: RequestOptions): APIPromise<AgentDeleteResponse>;
907
+ /**
908
+ * Gets a specific Agent.
909
+ */
910
+ get(id: string, params?: AgentGetParams | null | undefined, options?: RequestOptions): APIPromise<Agent>;
911
+ }
912
+
674
913
  declare interface BaseCreateAgentInteractionParams {
675
914
  /**
676
915
  * Path param: Which version of the API to use.
@@ -692,6 +931,12 @@ declare interface BaseCreateAgentInteractionParams {
692
931
  * Body param: Input only. Whether to run the model interaction in the background.
693
932
  */
694
933
  background?: boolean;
934
+ /**
935
+ * Body param: The environment configuration for the interaction. Can be an object
936
+ * specifying remote environment sources or a string referencing an existing
937
+ * environment ID.
938
+ */
939
+ environment?: string | Environment_2;
695
940
  /**
696
941
  * Body param: The ID of the previous interaction, if any.
697
942
  */
@@ -702,8 +947,8 @@ declare interface BaseCreateAgentInteractionParams {
702
947
  */
703
948
  response_format?: Array<AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown> | AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown;
704
949
  /**
705
- * Body param: The mime type of the response. This is required if response_format
706
- * is set.
950
+ * @deprecated Body param: The mime type of the response. This is required if
951
+ * response_format is set.
707
952
  */
708
953
  response_mime_type?: string;
709
954
  /**
@@ -755,6 +1000,12 @@ declare interface BaseCreateModelInteractionParams {
755
1000
  * Body param: Input only. Whether to run the model interaction in the background.
756
1001
  */
757
1002
  background?: boolean;
1003
+ /**
1004
+ * Body param: The environment configuration for the interaction. Can be an object
1005
+ * specifying remote environment sources or a string referencing an existing
1006
+ * environment ID.
1007
+ */
1008
+ environment?: string | Environment_2;
758
1009
  /**
759
1010
  * Body param: Input only. Configuration parameters for the model interaction.
760
1011
  */
@@ -769,8 +1020,8 @@ declare interface BaseCreateModelInteractionParams {
769
1020
  */
770
1021
  response_format?: Array<AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown> | AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown;
771
1022
  /**
772
- * Body param: The mime type of the response. This is required if response_format
773
- * is set.
1023
+ * @deprecated Body param: The mime type of the response. This is required if
1024
+ * response_format is set.
774
1025
  */
775
1026
  response_mime_type?: string;
776
1027
  /**
@@ -3264,6 +3515,77 @@ export declare enum Environment {
3264
3515
  ENVIRONMENT_BROWSER = "ENVIRONMENT_BROWSER"
3265
3516
  }
3266
3517
 
3518
+ /**
3519
+ * Configuration for a custom environment.
3520
+ */
3521
+ declare interface Environment_2 {
3522
+ type: 'remote';
3523
+ /**
3524
+ * Network configuration for the environment.
3525
+ */
3526
+ network?: 'disabled' | Environment_2.Allowlist;
3527
+ sources?: Array<Environment_2.Source>;
3528
+ }
3529
+
3530
+ declare namespace Environment_2 {
3531
+ /**
3532
+ * Outbound networking configuration for the sandbox. When specified, restricts
3533
+ * which external domains the sandbox can reach. Omit entirely to allow all
3534
+ * outbound traffic with no header injection.
3535
+ */
3536
+ interface Allowlist {
3537
+ /**
3538
+ * List of allowed outbound domains. Only requests to listed domains are permitted.
3539
+ * Use [{'domain': '*'}] to allow all domains while still injecting headers on
3540
+ * specific ones.
3541
+ */
3542
+ allowlist?: Array<Allowlist.Allowlist>;
3543
+ }
3544
+ namespace Allowlist {
3545
+ /**
3546
+ * A single domain allowlist rule with optional header injection.
3547
+ */
3548
+ interface Allowlist {
3549
+ /**
3550
+ * Domain to allow outbound requests to. Supports wildcards (e.g.
3551
+ * '_.googleapis.com'). Use '_' to allow all domains.
3552
+ */
3553
+ domain: string;
3554
+ /**
3555
+ * Headers to inject on all outbound requests matching this domain. Each entry is a
3556
+ * flat {header_name: header_value} object. The egress proxy injects these
3557
+ * automatically.
3558
+ */
3559
+ transform?: Array<{
3560
+ [key: string]: string;
3561
+ }>;
3562
+ }
3563
+ }
3564
+ /**
3565
+ * A source to be mounted into the environment.
3566
+ */
3567
+ interface Source {
3568
+ /**
3569
+ * The inline content if `type` is `INLINE`.
3570
+ */
3571
+ content?: string;
3572
+ /**
3573
+ * Optional encoding for inline content (e.g. `base64`).
3574
+ */
3575
+ encoding?: string;
3576
+ /**
3577
+ * The source of the environment. For GCS, this is the GCS path. For GitHub, this
3578
+ * is the GitHub path.
3579
+ */
3580
+ source?: string;
3581
+ /**
3582
+ * Where the source should appear in the environment.
3583
+ */
3584
+ target?: string;
3585
+ type?: 'gcs' | 'inline' | 'repository' | 'skill_registry';
3586
+ }
3587
+ }
3588
+
3267
3589
  declare interface ErrorEvent_2 {
3268
3590
  event_type: 'error';
3269
3591
  /**
@@ -4848,7 +5170,7 @@ export declare interface GenerationConfig {
4848
5170
  */
4849
5171
  declare interface GenerationConfig_2 {
4850
5172
  /**
4851
- * Configuration for image interaction.
5173
+ * @deprecated Configuration for image interaction.
4852
5174
  */
4853
5175
  image_config?: ImageConfig_2;
4854
5176
  /**
@@ -5136,10 +5458,12 @@ export declare class GoogleGenAI {
5136
5458
  readonly fileSearchStores: FileSearchStores;
5137
5459
  private _interactions;
5138
5460
  private _webhooks;
5461
+ private _agents;
5139
5462
  private _nextGenClient;
5140
5463
  private getNextGenClient;
5141
5464
  get interactions(): Interactions;
5142
5465
  get webhooks(): Webhooks;
5466
+ get agents(): Agents;
5143
5467
  constructor(options: GoogleGenAIOptions);
5144
5468
  }
5145
5469
 
@@ -6264,6 +6588,16 @@ declare interface Interaction {
6264
6588
  * Configuration parameters for the agent interaction.
6265
6589
  */
6266
6590
  agent_config?: DynamicAgentConfig | DeepResearchAgentConfig;
6591
+ /**
6592
+ * The environment configuration for the interaction. Can be an object specifying
6593
+ * remote environment sources or a string referencing an existing environment ID.
6594
+ */
6595
+ environment?: string | Environment_2;
6596
+ /**
6597
+ * Output only. The environment ID for the interaction. Only populated if
6598
+ * environment config is set in the request.
6599
+ */
6600
+ environment_id?: string;
6267
6601
  /**
6268
6602
  * The input for the interaction.
6269
6603
  */
@@ -6282,7 +6616,8 @@ declare interface Interaction {
6282
6616
  */
6283
6617
  response_format?: Array<AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown> | AudioResponseFormat | TextResponseFormat | ImageResponseFormat | unknown;
6284
6618
  /**
6285
- * The mime type of the response. This is required if response_format is set.
6619
+ * @deprecated The mime type of the response. This is required if response_format
6620
+ * is set.
6286
6621
  */
6287
6622
  response_mime_type?: string;
6288
6623
  /**
@@ -6432,7 +6767,7 @@ export declare class Interactions extends BaseInteractions {
6432
6767
  }
6433
6768
 
6434
6769
  export declare namespace Interactions {
6435
- export { type AllowedTools as AllowedTools, type Annotation as Annotation, type AudioContent as AudioContent, type AudioResponseFormat as AudioResponseFormat, type CodeExecutionCallArguments as CodeExecutionCallArguments, type CodeExecutionCallStep as CodeExecutionCallStep, type CodeExecutionResultStep as CodeExecutionResultStep, type Content_2 as Content, type DeepResearchAgentConfig as DeepResearchAgentConfig, type DocumentContent as DocumentContent, type DynamicAgentConfig as DynamicAgentConfig, type ErrorEvent_2 as ErrorEvent, type FileCitation as FileCitation, type FileSearchCallStep as FileSearchCallStep, type FileSearchResultStep as FileSearchResultStep, type Function_2 as Function, type FunctionCallStep as FunctionCallStep, type FunctionResultStep as FunctionResultStep, type GenerationConfig_2 as GenerationConfig, type GoogleMapsCallArguments as GoogleMapsCallArguments, type GoogleMapsCallStep as GoogleMapsCallStep, type GoogleMapsResult as GoogleMapsResult, type GoogleMapsResultStep as GoogleMapsResultStep, type GoogleSearchCallArguments as GoogleSearchCallArguments, type GoogleSearchCallStep as GoogleSearchCallStep, type GoogleSearchResult as GoogleSearchResult, type GoogleSearchResultStep as GoogleSearchResultStep, type ImageConfig_2 as ImageConfig, type ImageContent as ImageContent, type ImageResponseFormat as ImageResponseFormat, type Interaction as Interaction, type InteractionCompletedEvent as InteractionCompletedEvent, type InteractionCreatedEvent as InteractionCreatedEvent, type InteractionSSEEvent as InteractionSSEEvent, type InteractionStatusUpdate as InteractionStatusUpdate, type MCPServerToolCallStep as MCPServerToolCallStep, type MCPServerToolResultStep as MCPServerToolResultStep, type Model_2 as Model, type ModelOutputStep as ModelOutputStep, type PlaceCitation as PlaceCitation, type SpeechConfig_2 as SpeechConfig, type Step as Step, type StepDelta as StepDelta, type StepStart as StepStart, type StepStop as StepStop, type TextContent as TextContent, type TextResponseFormat as TextResponseFormat, type ThinkingLevel_2 as ThinkingLevel, type ThoughtStep as ThoughtStep, type Tool_2 as Tool, type ToolChoiceConfig as ToolChoiceConfig, type ToolChoiceType as ToolChoiceType, type URLCitation as URLCitation, type URLContextCallArguments as URLContextCallArguments, type URLContextCallStep as URLContextCallStep, type URLContextResult as URLContextResult, type URLContextResultStep as URLContextResultStep, type Usage as Usage, type UserInputStep as UserInputStep, type VideoContent as VideoContent, type WebhookConfig_2 as WebhookConfig, type InteractionDeleteResponse as InteractionDeleteResponse, type InteractionCreateParams as InteractionCreateParams, type CreateModelInteractionParamsNonStreaming as CreateModelInteractionParamsNonStreaming, type CreateModelInteractionParamsStreaming as CreateModelInteractionParamsStreaming, type CreateAgentInteractionParamsNonStreaming as CreateAgentInteractionParamsNonStreaming, type CreateAgentInteractionParamsStreaming as CreateAgentInteractionParamsStreaming, type InteractionDeleteParams as InteractionDeleteParams, type InteractionCancelParams as InteractionCancelParams, type InteractionGetParams as InteractionGetParams, type InteractionGetParamsNonStreaming as InteractionGetParamsNonStreaming, type InteractionGetParamsStreaming as InteractionGetParamsStreaming, };
6770
+ export { type AllowedTools as AllowedTools, type Annotation as Annotation, type AudioContent as AudioContent, type AudioResponseFormat as AudioResponseFormat, type CodeExecutionCallArguments as CodeExecutionCallArguments, type CodeExecutionCallStep as CodeExecutionCallStep, type CodeExecutionResultStep as CodeExecutionResultStep, type Content_2 as Content, type DeepResearchAgentConfig as DeepResearchAgentConfig, type DocumentContent as DocumentContent, type DynamicAgentConfig as DynamicAgentConfig, type Environment_2 as Environment, type ErrorEvent_2 as ErrorEvent, type FileCitation as FileCitation, type FileSearchCallStep as FileSearchCallStep, type FileSearchResultStep as FileSearchResultStep, type Function_2 as Function, type FunctionCallStep as FunctionCallStep, type FunctionResultStep as FunctionResultStep, type GenerationConfig_2 as GenerationConfig, type GoogleMapsCallArguments as GoogleMapsCallArguments, type GoogleMapsCallStep as GoogleMapsCallStep, type GoogleMapsResult as GoogleMapsResult, type GoogleMapsResultStep as GoogleMapsResultStep, type GoogleSearchCallArguments as GoogleSearchCallArguments, type GoogleSearchCallStep as GoogleSearchCallStep, type GoogleSearchResult as GoogleSearchResult, type GoogleSearchResultStep as GoogleSearchResultStep, type ImageConfig_2 as ImageConfig, type ImageContent as ImageContent, type ImageResponseFormat as ImageResponseFormat, type Interaction as Interaction, type InteractionCompletedEvent as InteractionCompletedEvent, type InteractionCreatedEvent as InteractionCreatedEvent, type InteractionSSEEvent as InteractionSSEEvent, type InteractionStatusUpdate as InteractionStatusUpdate, type MCPServerToolCallStep as MCPServerToolCallStep, type MCPServerToolResultStep as MCPServerToolResultStep, type Model_2 as Model, type ModelOutputStep as ModelOutputStep, type PlaceCitation as PlaceCitation, type SpeechConfig_2 as SpeechConfig, type Step as Step, type StepDelta as StepDelta, type StepStart as StepStart, type StepStop as StepStop, type TextContent as TextContent, type TextResponseFormat as TextResponseFormat, type ThinkingLevel_2 as ThinkingLevel, type ThoughtStep as ThoughtStep, type Tool_2 as Tool, type ToolChoiceConfig as ToolChoiceConfig, type ToolChoiceType as ToolChoiceType, type URLCitation as URLCitation, type URLContextCallArguments as URLContextCallArguments, type URLContextCallStep as URLContextCallStep, type URLContextResult as URLContextResult, type URLContextResultStep as URLContextResultStep, type Usage as Usage, type UserInputStep as UserInputStep, type VideoContent as VideoContent, type WebhookConfig_2 as WebhookConfig, type InteractionDeleteResponse as InteractionDeleteResponse, type InteractionCreateParams as InteractionCreateParams, type CreateModelInteractionParamsNonStreaming as CreateModelInteractionParamsNonStreaming, type CreateModelInteractionParamsStreaming as CreateModelInteractionParamsStreaming, type CreateAgentInteractionParamsNonStreaming as CreateAgentInteractionParamsNonStreaming, type CreateAgentInteractionParamsStreaming as CreateAgentInteractionParamsStreaming, type InteractionDeleteParams as InteractionDeleteParams, type InteractionCancelParams as InteractionCancelParams, type InteractionGetParams as InteractionGetParams, type InteractionGetParamsNonStreaming as InteractionGetParamsNonStreaming, type InteractionGetParamsStreaming as InteractionGetParamsStreaming, };
6436
6771
  }
6437
6772
 
6438
6773
  declare namespace InteractionsAPI {
@@ -6450,6 +6785,7 @@ declare namespace InteractionsAPI {
6450
6785
  DeepResearchAgentConfig,
6451
6786
  DocumentContent,
6452
6787
  DynamicAgentConfig,
6788
+ Environment_2 as Environment,
6453
6789
  ErrorEvent_2 as ErrorEvent,
6454
6790
  FileCitation,
6455
6791
  FileSearchCallStep,