gemini_adk_rs/agents/generated.rs
1// AUTO-GENERATED by gemini-adk-transpiler-rs -- do not edit manually
2// Source: adk-js
3// Generated: 2026-03-02T01:19:11Z
4
5#![allow(dead_code, unused_imports, clippy::type_complexity)]
6
7use crate::context::AgentEvent;
8use crate::{Agent, AgentError, InvocationContext, ToolFunction};
9use async_trait::async_trait;
10use std::sync::Arc;
11
12// BaseAgent — base class, fields merged into child agents via inheritance.
13
14// ---- LlmAgent ----
15
16/// The configuration options for creating an LLM-based agent.
17/// (Inherits fields from BaseAgent)
18// Cannot derive Clone: contains trait objects
19pub struct LlmAgentConfig {
20 pub name: String,
21 /// The model to use for the agent.
22 pub model: Option<String>,
23 /// Instructions for the LLM model, guiding the agent's behavior.
24 pub instruction: Option<String>,
25 /// Instructions for all the agents in the entire agent tree. ONLY the globalInstruction in root agent will take effect. For example: use globalInstruction to make all agents have a stable identity or personality.
26 pub global_instruction: Option<String>,
27 /// Tools available to this agent.
28 pub tools: Option<Vec<Arc<dyn ToolFunction>>>,
29 /// The additional content generation configurations. NOTE: not all fields are usable, e.g. tools must be configured via `tools`, thinking_config must be configured via `planner` in LlmAgent. For example: use this config to adjust model temperature, configure safety settings, etc.
30 pub generate_content_config: Option<serde_json::Value>,
31 /// Disallows LLM-controlled transferring to the parent agent. NOTE: Setting this as True also prevents this agent to continue reply to the end-user. This behavior prevents one-way transfer, in which end-user may be stuck with one agent that cannot transfer to other agents in the agent tree.
32 pub disallow_transfer_to_parent: Option<bool>,
33 /// Disallows LLM-controlled transferring to the peer agents.
34 pub disallow_transfer_to_peers: Option<bool>,
35 /// Controls content inclusion in model requests. Options: default: Model receives relevant conversation history none: Model receives no prior history, operates solely on current instruction and input
36 pub include_contents: Option<String>,
37 /// The input schema when agent is used as a tool.
38 pub input_schema: Option<serde_json::Value>,
39 /// The output schema when agent replies.
40 pub output_schema: Option<serde_json::Value>,
41 /// The key in session state to store the output of the agent. Typically use cases: - Extracts agent reply for later use, such as in tools, callbacks, etc. - Connects agents to coordinate with each other.
42 pub output_key: Option<String>,
43 /// Processors to run before the LLM request is sent.
44 pub request_processors: Option<Vec<serde_json::Value>>,
45 /// Processors to run after the LLM response is received.
46 pub response_processors: Option<Vec<serde_json::Value>>,
47 /// Instructs the agent to make a plan and execute it step by step.
48 pub code_executor: Option<serde_json::Value>,
49 pub description: Option<String>,
50 pub parent_agent: Option<Arc<dyn Agent>>,
51 pub sub_agents: Option<Vec<Arc<dyn Agent>>>,
52 /// Callbacks to be called before calling the LLM.
53 pub before_model_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
54 /// Callbacks to be called after calling the LLM.
55 pub after_model_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
56 /// Callbacks to be called before calling the tool.
57 pub before_tool_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
58 /// Callbacks to be called after calling the tool.
59 pub after_tool_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
60 pub before_agent_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
61 pub after_agent_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
62}
63
64impl LlmAgentConfig {
65 pub fn new(name: impl Into<String>) -> Self {
66 Self {
67 name: name.into(),
68 model: None,
69 instruction: None,
70 global_instruction: None,
71 tools: None,
72 generate_content_config: None,
73 disallow_transfer_to_parent: None,
74 disallow_transfer_to_peers: None,
75 include_contents: None,
76 input_schema: None,
77 output_schema: None,
78 output_key: None,
79 request_processors: None,
80 response_processors: None,
81 code_executor: None,
82 description: None,
83 parent_agent: None,
84 sub_agents: None,
85 before_model_callback: None,
86 after_model_callback: None,
87 before_tool_callback: None,
88 after_tool_callback: None,
89 before_agent_callback: None,
90 after_agent_callback: None,
91 }
92 }
93}
94
95pub struct LlmAgentBuilder {
96 config: LlmAgentConfig,
97}
98
99impl LlmAgentBuilder {
100 pub fn new(name: impl Into<String>) -> Self {
101 Self {
102 config: LlmAgentConfig::new(name),
103 }
104 }
105
106 pub fn model(mut self, value: String) -> Self {
107 self.config.model = Some(value);
108 self
109 }
110
111 pub fn instruction(mut self, value: String) -> Self {
112 self.config.instruction = Some(value);
113 self
114 }
115
116 pub fn global_instruction(mut self, value: String) -> Self {
117 self.config.global_instruction = Some(value);
118 self
119 }
120
121 pub fn tools(mut self, value: Vec<Arc<dyn ToolFunction>>) -> Self {
122 self.config.tools = Some(value);
123 self
124 }
125
126 pub fn generate_content_config(mut self, value: serde_json::Value) -> Self {
127 self.config.generate_content_config = Some(value);
128 self
129 }
130
131 pub fn disallow_transfer_to_parent(mut self, value: bool) -> Self {
132 self.config.disallow_transfer_to_parent = Some(value);
133 self
134 }
135
136 pub fn disallow_transfer_to_peers(mut self, value: bool) -> Self {
137 self.config.disallow_transfer_to_peers = Some(value);
138 self
139 }
140
141 pub fn include_contents(mut self, value: String) -> Self {
142 self.config.include_contents = Some(value);
143 self
144 }
145
146 pub fn input_schema(mut self, value: serde_json::Value) -> Self {
147 self.config.input_schema = Some(value);
148 self
149 }
150
151 pub fn output_schema(mut self, value: serde_json::Value) -> Self {
152 self.config.output_schema = Some(value);
153 self
154 }
155
156 pub fn output_key(mut self, value: String) -> Self {
157 self.config.output_key = Some(value);
158 self
159 }
160
161 pub fn request_processors(mut self, value: Vec<serde_json::Value>) -> Self {
162 self.config.request_processors = Some(value);
163 self
164 }
165
166 pub fn response_processors(mut self, value: Vec<serde_json::Value>) -> Self {
167 self.config.response_processors = Some(value);
168 self
169 }
170
171 pub fn code_executor(mut self, value: serde_json::Value) -> Self {
172 self.config.code_executor = Some(value);
173 self
174 }
175
176 pub fn description(mut self, value: String) -> Self {
177 self.config.description = Some(value);
178 self
179 }
180
181 pub fn parent_agent(mut self, value: Arc<dyn Agent>) -> Self {
182 self.config.parent_agent = Some(value);
183 self
184 }
185
186 pub fn sub_agents(mut self, value: Vec<Arc<dyn Agent>>) -> Self {
187 self.config.sub_agents = Some(value);
188 self
189 }
190
191 pub fn build(self) -> LlmAgent {
192 LlmAgent {
193 config: self.config,
194 }
195 }
196}
197
198pub struct LlmAgent {
199 pub config: LlmAgentConfig,
200}
201
202// Agent trait impl for LlmAgent should be provided by the application.
203
204// ---- LoopAgent ----
205
206/// The configuration options for creating a loop agent.
207/// (Inherits fields from BaseAgent)
208// Cannot derive Clone: contains trait objects
209pub struct LoopAgentConfig {
210 pub name: String,
211 /// The maximum number of iterations the loop agent will run. If not provided, the loop agent will run indefinitely.
212 pub max_iterations: Option<f64>,
213 pub description: Option<String>,
214 pub parent_agent: Option<Arc<dyn Agent>>,
215 pub sub_agents: Option<Vec<Arc<dyn Agent>>>,
216 pub before_agent_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
217 pub after_agent_callback: Option<Box<dyn Fn(&InvocationContext) + Send + Sync>>,
218}
219
220impl LoopAgentConfig {
221 pub fn new(name: impl Into<String>) -> Self {
222 Self {
223 name: name.into(),
224 max_iterations: None,
225 description: None,
226 parent_agent: None,
227 sub_agents: None,
228 before_agent_callback: None,
229 after_agent_callback: None,
230 }
231 }
232}
233
234pub struct LoopAgentBuilder {
235 config: LoopAgentConfig,
236}
237
238impl LoopAgentBuilder {
239 pub fn new(name: impl Into<String>) -> Self {
240 Self {
241 config: LoopAgentConfig::new(name),
242 }
243 }
244
245 pub fn max_iterations(mut self, value: f64) -> Self {
246 self.config.max_iterations = Some(value);
247 self
248 }
249
250 pub fn description(mut self, value: String) -> Self {
251 self.config.description = Some(value);
252 self
253 }
254
255 pub fn parent_agent(mut self, value: Arc<dyn Agent>) -> Self {
256 self.config.parent_agent = Some(value);
257 self
258 }
259
260 pub fn sub_agents(mut self, value: Vec<Arc<dyn Agent>>) -> Self {
261 self.config.sub_agents = Some(value);
262 self
263 }
264
265 pub fn build(self) -> LoopAgent {
266 LoopAgent {
267 config: self.config,
268 }
269 }
270}
271
272pub struct LoopAgent {
273 pub config: LoopAgentConfig,
274}
275
276#[async_trait]
277impl Agent for LoopAgent {
278 fn name(&self) -> &str {
279 &self.config.name
280 }
281
282 fn sub_agents(&self) -> Vec<Arc<dyn Agent>> {
283 self.config.sub_agents.clone().unwrap_or_default()
284 }
285
286 async fn run_live(&self, ctx: &mut InvocationContext) -> Result<(), AgentError> {
287 let inner = crate::agents::loop_agent::LoopAgent::new(
288 &self.config.name,
289 self.sub_agents(),
290 self.config.max_iterations.map(|v| v as u32).unwrap_or(10),
291 );
292 inner.run_live(ctx).await
293 }
294}
295
296// ---- ActiveStreamingToolParams ----
297
298/// The parameters for creating an ActiveStreamingTool.
299#[derive(Debug, Clone, Default)]
300pub struct ActiveStreamingToolParams {
301 pub task: Option<serde_json::Value>,
302 pub stream: Option<serde_json::Value>,
303}
304
305// ---- AgentTool ----
306
307/// The configuration of the agent tool.
308// Cannot derive Clone: contains trait objects
309pub struct AgentTool {
310 /// The reference to the agent instance.
311 pub agent: Arc<dyn Agent>,
312 /// Whether to skip summarization of the agent output.
313 pub skip_summarization: Option<bool>,
314}
315
316// ---- Auth ----
317
318/// The auth config sent by tool asking client to collect auth credentials and adk and client will help to fill in the response.
319#[derive(Debug, Clone, Default)]
320pub struct Auth {
321 /// The auth scheme used to collect credentials
322 pub auth_scheme: serde_json::Value,
323 /// The raw auth credential used to collect credentials. The raw auth credentials are used in some auth scheme that needs to exchange auth credentials. e.g. OAuth2 and OIDC. For other auth scheme, it could be undefined.
324 pub raw_auth_credential: Option<serde_json::Value>,
325 /// The exchanged auth credential used to collect credentials. adk and client will work together to fill it. For those auth scheme that doesn't need to exchange auth credentials, e.g. API key, service account etc. It's filled by client directly. For those auth scheme that need to exchange auth credentials, e.g. OAuth2 and OIDC, it's first filled by adk. If the raw credentials passed by tool only has client id and client credential, adk will help to generate the corresponding authorization uri and state and store the processed credential in this field. If the raw credentials passed by tool already has authorization uri, state, etc. then it's copied to this field. Client will use this field to guide the user through the OAuth2 flow and fill auth response in this field
326 pub exchanged_auth_credential: Option<serde_json::Value>,
327 /// A user specified key used to load and save this credential in a credential service.
328 pub credential_key: String,
329}
330
331// ---- BaseToolParams ----
332
333/// Parameters for the BaseTool constructor.
334#[derive(Debug, Clone, Default)]
335pub struct BaseToolParams {
336 pub name: String,
337 pub description: String,
338 pub is_long_running: Option<bool>,
339}
340
341// ---- RunAsyncToolRequest ----
342
343/// The parameters for `runAsync`.
344#[derive(Debug, Clone, Default)]
345pub struct RunAsyncToolRequest {
346 pub args: serde_json::Value,
347 pub tool_context: serde_json::Value,
348}
349
350// ---- ToolProcessLlmRequest ----
351
352/// The parameters for `processLlmRequest`.
353#[derive(Debug, Clone, Default)]
354pub struct ToolProcessLlmRequest {
355 pub tool_context: serde_json::Value,
356 pub llm_request: serde_json::Value,
357}
358
359// ---- TraceMergedToolCallsParams ----
360
361#[derive(Debug, Clone, Default)]
362pub struct TraceMergedToolCallsParams {
363 pub response_event_id: String,
364 pub function_response_event: serde_json::Value,
365}
366
367// ---- TraceToolCallParams ----
368
369// Cannot derive Clone: contains trait objects
370pub struct TraceToolCallParams {
371 pub tool: Arc<dyn ToolFunction>,
372 pub args: serde_json::Value,
373 pub function_response_event: serde_json::Value,
374}
375
376// ============================================================
377// General type definitions extracted from ADK-JS source
378// ============================================================
379
380// ---- A2AMetadataKeys (module: a2a) ----
381
382#[derive(Debug, Clone, PartialEq, Eq)]
383pub enum A2AMetadataKeys {
384 PARTIAL,
385 TaskId,
386 ContextId,
387 ESCALATE,
388 TransferToAgent,
389 LongRunning,
390 THOUGHT,
391}
392
393// ---- ActivityEvent (module: events) ----
394
395/// Represents a generic activity or status update.
396#[derive(Debug, Clone, Default)]
397pub struct ActivityEvent {
398 pub r#type: serde_json::Value,
399 pub kind: String,
400 pub detail: serde_json::Value,
401}
402
403// ---- ApigeeLlmParams (module: models) ----
404
405#[derive(Debug, Clone, Default)]
406pub struct ApigeeLlmParams {
407 /// The name of the model to use. The model string specifies the LLM provider (e.g., Vertex AI, Gemini), API version, and the model ID. Supported format: `apigee/[<provider>/][<version>/]<model_id>` Components: `provider` (optional): `vertex_ai` or `gemini`. `version` (optional): The API version (e.g., `v1`, `v1beta`). If not provided, a default version will selected based on the provider. `model_id` (required): The model identifier (e.g., `gemini-2.5-flash`). Examples: - `apigee/gemini-2.5-flash` - `apigee/v1/gemini-2.5-flash` - `apigee/vertex_ai/gemini-2.5-flash` - `apigee/gemini/v1/gemini-2.5-flash` - `apigee/vertex_ai/v1beta/gemini-2.5-flash`
408 pub model: String,
409 /// The proxy URL for the provider API. If not provided, it will look for the APIGEE_PROXY_URL environment variable.
410 pub proxy_url: Option<String>,
411 /// API key to use. If not provided, it will look for the GOOGLE_GENAI_API_KEY or GEMINI_API_KEY environment variable. If gemini provider is selected and no key is provided, the fake key "-" will be used for the "x-goog-api-key" header.
412 pub api_key: Option<String>,
413}
414
415// ---- AppendEventRequest (module: sessions) ----
416
417/// The parameters for `appendEvent`.
418#[derive(Debug, Clone, Default)]
419pub struct AppendEventRequest {
420 /// The session to append the event to.
421 pub session: serde_json::Value,
422 /// The event to append.
423 pub event: serde_json::Value,
424}
425
426// ---- ArtifactVersion (module: artifacts) ----
427
428/// Metadata for a file artifact version.
429#[derive(Debug, Clone, Default)]
430pub struct ArtifactVersion {
431 /// The version number.
432 pub version: f64,
433 /// The canonical URI of the artifact.
434 pub canonical_uri: Option<String>,
435 /// Custom metadata associated with the artifact.
436 pub custom_metadata: Option<serde_json::Value>,
437 /// The MIME type of the artifact.
438 pub mime_type: Option<String>,
439}
440
441// ---- AuthCredential (module: auth) ----
442
443/// Data class representing an authentication credential. To exchange for the actual credential, please use CredentialExchanger.exchangeCredential(). @example // API Key Auth const authCredential: AuthCredential = { authType: AuthCredentialTypes.API_KEY, apiKey: "your_api_key", }; @example // HTTP Auth const authCredential: AuthCredential = { authType: AuthCredentialTypes.HTTP, http: { scheme: "basic", credentials: { username: "user", password: "password", }, } } @example // OAuth2 Bearer Token in HTTP Header const authCredential: AuthCredential = { authType: AuthCredentialTypes.HTTP, http: { scheme: "bearer", credentials: { token: "your_access_token", }, } } @example // OAuth2 Auth with Authorization Code Flow const authCredential: AuthCredential = { authType: AuthCredentialTypes.OAUTH2, oauth2: { clientId: "your_client_id", clientSecret: "your_client_secret", } } @example: // Open ID Connect Auth const authCredential: AuthCredential = { authType: AuthCredentialTypes.OPEN_ID_CONNECT, oauth2: { clientId: "1234", clientSecret: "secret", redirectUri: "https://example.com", scopes: ["scope1", "scope2"], } } @example: // Auth with resource reference const authCredential: AuthCredential = { authType: AuthCredentialTypes.API_KEY, resourceRef: "projects/1234/locations/us-central1/resources/resource1" }
444#[derive(Debug, Clone, Default)]
445pub struct AuthCredential {
446 pub auth_type: serde_json::Value,
447 /// Resource reference for the credential. This will be supported in the future.
448 pub resource_ref: Option<String>,
449 pub api_key: Option<String>,
450 pub http: Option<serde_json::Value>,
451 pub service_account: Option<serde_json::Value>,
452 pub oauth2: Option<serde_json::Value>,
453}
454
455// ---- AuthToolArguments (module: auth) ----
456
457/// The arguments for the special long running function tool that is used to request end user credentials.
458#[derive(Debug, Clone, Default)]
459pub struct AuthToolArguments {
460 pub function_call_id: String,
461 pub auth_config: serde_json::Value,
462}
463
464// ---- BaseArtifactService (module: artifacts) ----
465
466/// Interface for artifact services.
467#[derive(Debug, Clone, Default)]
468pub struct BaseArtifactService {
469 /// Gets metadata for a specific artifact version.
470 pub request: serde_json::Value,
471}
472
473// ---- BaseCredentialExchanger (module: auth) ----
474
475/// Base interface for credential exchangers. Credential exchangers are responsible for exchanging credentials from one format or scheme to another.
476#[derive(Debug, Clone, Default)]
477pub struct BaseCredentialExchanger {
478 pub auth_credential: serde_json::Value,
479 pub auth_scheme: Option<serde_json::Value>,
480}
481
482// ---- BaseCredentialService (module: auth) ----
483
484/// Abstract class for Service that loads / saves tool credentials from / to the backend credential store.
485#[derive(Debug, Clone, Default)]
486pub struct BaseCredentialService {
487 pub auth_config: serde_json::Value,
488 pub tool_context: serde_json::Value,
489}
490
491// ---- BaseLlmConnection (module: models) ----
492
493/// The base class for a live model connection.
494#[derive(Debug, Clone, Default)]
495pub struct BaseLlmConnection {}
496
497// ---- BaseMemoryService (module: memory) ----
498
499/// Base interface for memory services. The service provides functionalities to ingest sessions into memory so that the memory can be used for user queries.
500#[derive(Debug, Clone, Default)]
501pub struct BaseMemoryService {}
502
503// ---- BasePolicyEngine (module: plugins) ----
504
505#[derive(Debug, Clone, Default)]
506pub struct BasePolicyEngine {}
507
508// ---- CallCodeEvent (module: events) ----
509
510/// Represents a request to execute code.
511#[derive(Debug, Clone)]
512pub struct CallCodeEvent {
513 pub r#type: serde_json::Value,
514 pub code: gemini_genai_rs::prelude::ExecutableCode,
515}
516
517// ---- CodeExecutionInput (module: code_executors) ----
518
519/// A structure that contains the input of code execution. */
520#[derive(Debug, Clone, Default)]
521pub struct CodeExecutionInput {
522 /// The code to execute.
523 pub code: String,
524 /// The input files available to the code.
525 pub input_files: Vec<serde_json::Value>,
526 /// The execution ID for the stateful code execution.
527 pub execution_id: Option<String>,
528}
529
530// ---- CodeExecutionResult (module: code_executors) ----
531
532#[derive(Debug, Clone, Default)]
533pub struct CodeExecutionResult {
534 pub code: String,
535 pub result_stdout: String,
536 pub result_stderr: String,
537 pub timestamp: f64,
538}
539
540// ---- CodeGroupMatch (module: code_executors) ----
541
542#[derive(Debug, Clone, Default)]
543pub struct CodeGroupMatch {
544 pub groups: Option</* {prefix?: string; codeStr?: string} */ String>,
545 pub index: Option<f64>,
546 pub length: Option<f64>,
547}
548
549// ---- CodeResultEvent (module: events) ----
550
551/// Represents the result of code execution.
552#[derive(Debug, Clone)]
553pub struct CodeResultEvent {
554 pub r#type: serde_json::Value,
555 pub result: gemini_genai_rs::prelude::CodeExecutionResult,
556}
557
558// ---- ContentEvent (module: events) ----
559
560/// Represents partial content (text delta) intended for the user.
561#[derive(Debug, Clone, Default)]
562pub struct ContentEvent {
563 pub r#type: serde_json::Value,
564 pub content: String,
565}
566
567// ---- CreateSessionRequest (module: sessions) ----
568
569/// The parameters for `createSession`.
570#[derive(Debug, Clone, Default)]
571pub struct CreateSessionRequest {
572 /// The name of the application.
573 pub app_name: String,
574 /// The ID of the user.
575 pub user_id: String,
576 /// The initial state of the session.
577 pub state: Option<serde_json::Value>,
578 /// The ID of the session. A new ID will be generated if not provided.
579 pub session_id: Option<String>,
580}
581
582// ---- DataPartType (module: a2a) ----
583
584/// The types of data parts.
585#[derive(Debug, Clone, PartialEq, Eq)]
586pub enum DataPartType {
587 FunctionCall,
588 FunctionResponse,
589 CodeExecResult,
590 CodeExecutableCode,
591}
592
593// ---- DeleteArtifactRequest (module: artifacts) ----
594
595/// The parameters for `deleteArtifact`.
596#[derive(Debug, Clone, Default)]
597pub struct DeleteArtifactRequest {
598 /// The app name.
599 pub app_name: String,
600 /// The user ID.
601 pub user_id: String,
602 /// The session ID.
603 pub session_id: String,
604 /// The filename of the artifact.
605 pub filename: String,
606}
607
608// ---- DeleteSessionRequest (module: sessions) ----
609
610/// The parameters for `deleteSession`.
611#[derive(Debug, Clone, Default)]
612pub struct DeleteSessionRequest {
613 /// The name of the application.
614 pub app_name: String,
615 /// The ID of the user.
616 pub user_id: String,
617 /// The ID of the session.
618 pub session_id: String,
619}
620
621// ---- ErrorEvent (module: events) ----
622
623/// Represents a runtime error.
624#[derive(Debug, Clone, Default)]
625pub struct ErrorEvent {
626 pub r#type: serde_json::Value,
627 pub error: serde_json::Value,
628}
629
630// ---- Event (module: events) ----
631
632/// Represents an event in a conversation between agents and users. It is used to store the content of the conversation, as well as the actions taken by the agents like function calls, etc.
633#[derive(Debug, Clone, Default)]
634pub struct Event {
635 /// The unique identifier of the event. Do not assign the ID. It will be assigned by the session.
636 pub id: String,
637 /// The invocation ID of the event. Should be non-empty before appending to a session.
638 pub invocation_id: String,
639 /// "user" or the name of the agent, indicating who appended the event to the session.
640 pub author: Option<String>,
641 /// The actions taken by the agent.
642 pub actions: serde_json::Value,
643 /// Set of ids of the long running function calls. Agent client will know from this field about which function call is long running. Only valid for function call event
644 pub long_running_tool_ids: Option<Vec<String>>,
645 /// The branch of the event. The format is like agent_1.agent_2.agent_3, where agent_1 is the parent of agent_2, and agent_2 is the parent of agent_3. Branch is used when multiple sub-agent shouldn't see their peer agents' conversation history.
646 pub branch: Option<String>,
647 /// The timestamp of the event.
648 pub timestamp: f64,
649}
650
651// ---- EventActions (module: events) ----
652
653/// Represents the actions attached to an event.
654#[derive(Debug, Clone, Default)]
655pub struct EventActions {
656 /// If true, it won't call model to summarize function response. Only used for function_response event.
657 pub skip_summarization: Option<bool>,
658 /// Indicates that the event is updating the state with the given delta.
659 pub state_delta: String,
660 /// Indicates that the event is updating an artifact. key is the filename, value is the version.
661 pub artifact_delta: String,
662 /// If set, the event transfers to the specified agent.
663 pub transfer_to_agent: Option<String>,
664 /// The agent is escalating to a higher level agent.
665 pub escalate: Option<bool>,
666 /// Authentication configurations requested by tool responses. This field will only be set by a tool response event indicating tool request auth credential. - Keys: The function call id. Since one function response event could contain multiple function responses that correspond to multiple function calls. Each function call could request different auth configs. This id is used to identify the function call. - Values: The requested auth config.
667 pub requested_auth_configs: String,
668 /// A dict of tool confirmation requested by this event, keyed by the function call id.
669 pub requested_tool_confirmations: String,
670}
671
672// ---- EventType (module: events) ----
673
674/// The types of events that can be parsed from a raw Event.
675#[derive(Debug, Clone, PartialEq, Eq)]
676pub enum EventType {
677 THOUGHT,
678 CONTENT,
679 ToolCall,
680 ToolResult,
681 CallCode,
682 CodeResult,
683 ERROR,
684 ACTIVITY,
685 ToolConfirmation,
686 FINISHED,
687}
688
689// ---- Example (module: examples) ----
690
691/// A few-shot example.
692#[derive(Debug, Clone)]
693pub struct Example {
694 /// The input content for the example.
695 pub input: gemini_genai_rs::prelude::Content,
696 /// The expected output content for the example.
697 pub output: Vec<gemini_genai_rs::prelude::Content>,
698}
699
700// ---- ExecuteCodeParams (module: code_executors) ----
701
702/// The parameters for executing code. */
703#[derive(Debug, Clone, Default)]
704pub struct ExecuteCodeParams {
705 /// The invocation context of the code execution.
706 pub invocation_context: serde_json::Value,
707 /// The input of the code execution.
708 pub code_execution_input: serde_json::Value,
709}
710
711// ---- ExecutorContext (module: a2a) ----
712
713/// The A2A Agent Executor context.
714#[derive(Debug, Clone)]
715pub struct ExecutorContext {
716 pub user_id: String,
717 pub session_id: String,
718 pub agent_name: String,
719 pub readonly_state: serde_json::Value,
720 pub events: Vec<serde_json::Value>,
721 pub user_content: gemini_genai_rs::prelude::Content,
722 pub request_context: serde_json::Value,
723}
724
725// ---- File (module: code_executors) ----
726
727/// A structure that contains a file name and its content
728#[derive(Debug, Clone, Default)]
729pub struct File {
730 /// The name of the file with file extension(e.g., ' file.csv')
731 pub name: String,
732 /// The base64 - encoded bytes of the file content.
733 pub content: String,
734 /// The mime type of the file (e.g., ' image / png')
735 pub mime_type: String,
736}
737
738// ---- FileArtifactVersion (module: artifacts) ----
739
740/// Metadata for a file artifact version.
741#[derive(Debug, Clone, Default)]
742pub struct FileArtifactVersion {
743 pub file_name: Option<String>,
744}
745
746// ---- FinishedEvent (module: events) ----
747
748/// Represents the final completion of the agent's task.
749#[derive(Debug, Clone, Default)]
750pub struct FinishedEvent {
751 pub r#type: serde_json::Value,
752 pub output: Option<serde_json::Value>,
753}
754
755// ---- GeminiParams (module: models) ----
756
757/// The parameters for creating a Gemini instance.
758#[derive(Debug, Clone, Default)]
759pub struct GeminiParams {
760 /// The name of the model to use. Defaults to 'gemini-2.5-flash'.
761 pub model: Option<String>,
762 /// The API key to use for the Gemini API. If not provided, it will look for the GOOGLE_GENAI_API_KEY or GEMINI_API_KEY environment variable.
763 pub api_key: Option<String>,
764 /// Whether to use Vertex AI. If true, `project`, `location` should be provided.
765 pub vertexai: Option<bool>,
766 /// The Vertex AI project ID. Required if `vertexai` is true.
767 pub project: Option<String>,
768 /// The Vertex AI location. Required if `vertexai` is true.
769 pub location: Option<String>,
770 /// Headers to merge with internally crafted headers.
771 pub headers: Option<serde_json::Value>,
772}
773
774// ---- GetSessionConfig (module: sessions) ----
775
776/// The configuration of getting a session.
777#[derive(Debug, Clone, Default)]
778pub struct GetSessionConfig {
779 /// The number of recent events to retrieve.
780 pub num_recent_events: Option<f64>,
781 /// Retrieve events after this timestamp.
782 pub after_timestamp: Option<f64>,
783}
784
785// ---- GetSessionRequest (module: sessions) ----
786
787/// The parameters for `getSession`.
788#[derive(Debug, Clone, Default)]
789pub struct GetSessionRequest {
790 /// The name of the application.
791 pub app_name: String,
792 /// The ID of the user.
793 pub user_id: String,
794 /// The ID of the session.
795 pub session_id: String,
796 /// The configurations for getting the session.
797 pub config: Option<serde_json::Value>,
798}
799
800// ---- HttpAuth (module: auth) ----
801
802/// The credentials and metadata for HTTP authentication.
803#[derive(Debug, Clone, Default)]
804pub struct HttpAuth {
805 /// The name of the HTTP Authorization scheme to be used in the Authorization header as defined in RFC7235. The values used SHOULD be registered in the IANA Authentication Scheme registry. Examples: 'basic', 'bearer'
806 pub scheme: String,
807 pub credentials: serde_json::Value,
808}
809
810// ---- HttpCredentials (module: auth) ----
811
812/// Represents the secret token value for HTTP authentication, like user name, password, oauth token, etc.
813#[derive(Debug, Clone, Default)]
814pub struct HttpCredentials {
815 pub username: Option<String>,
816 pub password: Option<String>,
817 pub token: Option<String>,
818}
819
820// ---- InvocationContextParams (module: agents) ----
821
822/// The parameters for creating an invocation context.
823// Cannot derive Clone or Default
824pub struct InvocationContextParams {
825 pub artifact_service: Option<serde_json::Value>,
826 pub session_service: Option<serde_json::Value>,
827 pub memory_service: Option<serde_json::Value>,
828 pub credential_service: Option<serde_json::Value>,
829 pub invocation_id: String,
830 pub branch: Option<String>,
831 pub agent: Arc<dyn Agent>,
832 pub user_content: Option<gemini_genai_rs::prelude::Content>,
833 pub session: serde_json::Value,
834 pub end_invocation: Option<bool>,
835 pub transcription_cache: Option<Vec<serde_json::Value>>,
836 pub run_config: Option<serde_json::Value>,
837 pub live_request_queue: Option<serde_json::Value>,
838 pub active_streaming_tools: Option<serde_json::Value>,
839 pub plugin_manager: serde_json::Value,
840}
841
842// ---- ListArtifactKeysRequest (module: artifacts) ----
843
844/// The parameters for `listArtifactKeys`.
845#[derive(Debug, Clone, Default)]
846pub struct ListArtifactKeysRequest {
847 /// The app name.
848 pub app_name: String,
849 /// The user ID.
850 pub user_id: String,
851 /// The session ID.
852 pub session_id: String,
853}
854
855// ---- ListSessionsRequest (module: sessions) ----
856
857/// The parameters for `listSessions`.
858#[derive(Debug, Clone, Default)]
859pub struct ListSessionsRequest {
860 /// The name of the application.
861 pub app_name: String,
862 /// The ID of the user.
863 pub user_id: String,
864}
865
866// ---- ListSessionsResponse (module: sessions) ----
867
868/// The response of listing sessions. The events and states are not set within each Session object.
869#[derive(Debug, Clone, Default)]
870pub struct ListSessionsResponse {
871 /// A list of sessions.
872 pub sessions: Vec<serde_json::Value>,
873}
874
875// ---- ListVersionsRequest (module: artifacts) ----
876
877/// The parameters for `listVersions`.
878#[derive(Debug, Clone, Default)]
879pub struct ListVersionsRequest {
880 /// The app name.
881 pub app_name: String,
882 /// The user ID.
883 pub user_id: String,
884 /// The session ID.
885 pub session_id: String,
886 /// The filename of the artifact.
887 pub filename: String,
888}
889
890// ---- LiveRequest (module: agents) ----
891
892/// Request sent to live agents.
893#[derive(Debug, Clone, Default)]
894pub struct LiveRequest {
895 /// If set, send the content to the model in turn-by-turn mode.
896 pub content: Option<gemini_genai_rs::prelude::Content>,
897 /// If set, send the blob to the model in realtime mode.
898 pub blob: Option<gemini_genai_rs::prelude::Blob>,
899 /// If set, signal the start of user activity to the model.
900 pub activity_start: Option<gemini_genai_rs::prelude::ActivityStart>,
901 /// If set, signal the end of user activity to the model.
902 pub activity_end: Option<gemini_genai_rs::prelude::ActivityEnd>,
903 /// If set, close the queue.
904 pub close: Option<bool>,
905}
906
907// ---- LlmRequest (module: models) ----
908
909/// LLM request class that allows passing in tools, output schema and system instructions to the model.
910#[derive(Debug, Clone)]
911pub struct LlmRequest {
912 /// The model name.
913 pub model: Option<String>,
914 /// The contents to send to the model.
915 pub contents: Vec<gemini_genai_rs::prelude::Content>,
916 /// Additional config for the generate content request. Tools in generateContentConfig should not be set directly; use appendTools.
917 pub config: Option<serde_json::Value>,
918 pub live_connect_config: serde_json::Value,
919 /// The tools dictionary. Excluded from JSON serialization.
920 pub tools_dict: String,
921}
922
923// ---- LlmResponse (module: models) ----
924
925/// LLM response class that provides the first candidate response from the model if available. Otherwise, returns error code and message.
926#[derive(Debug, Clone, Default)]
927pub struct LlmResponse {
928 /// The content of the response.
929 pub content: Option<gemini_genai_rs::prelude::Content>,
930 /// The grounding metadata of the response.
931 pub grounding_metadata: Option<gemini_genai_rs::prelude::GroundingMetadata>,
932 /// Indicates whether the text content is part of a unfinished text stream. Only used for streaming mode and when the content is plain text.
933 pub partial: Option<bool>,
934 /// Indicates whether the response from the model is complete. Only used for streaming mode.
935 pub turn_complete: Option<bool>,
936 /// Error code if the response is an error. Code varies by model.
937 pub error_code: Option<String>,
938 /// Error message if the response is an error.
939 pub error_message: Option<String>,
940 /// Flag indicating that LLM was interrupted when generating the content. Usually it's due to user interruption during a bidi streaming.
941 pub interrupted: Option<bool>,
942 /// The custom metadata of the LlmResponse. An optional key-value pair to label an LlmResponse. NOTE: the entire object must be JSON serializable.
943 pub custom_metadata: Option</* {[key: string]: unknown} */ String>,
944 /// The usage metadata of the LlmResponse.
945 pub usage_metadata: Option<serde_json::Value>,
946 /// The finish reason of the response.
947 pub finish_reason: Option<serde_json::Value>,
948 /// The session resumption update of the LlmResponse
949 pub live_session_resumption_update:
950 Option<gemini_genai_rs::prelude::SessionResumptionUpdatePayload>,
951 /// Audio transcription of user input.
952 pub input_transcription: Option<gemini_genai_rs::prelude::TranscriptionPayload>,
953 /// Audio transcription of model output.
954 pub output_transcription: Option<gemini_genai_rs::prelude::TranscriptionPayload>,
955}
956
957// ---- LoadArtifactRequest (module: artifacts) ----
958
959/// The parameters for `loadArtifact`.
960#[derive(Debug, Clone, Default)]
961pub struct LoadArtifactRequest {
962 /// The app name.
963 pub app_name: String,
964 /// The user ID.
965 pub user_id: String,
966 /// The session ID.
967 pub session_id: String,
968 /// The filename of the artifact.
969 pub filename: String,
970 /// The version of the artifact to load. If not provided, the latest version of the artifact is loaded.
971 pub version: Option<f64>,
972}
973
974// ---- LogLevel (module: utils) ----
975
976/// Log levels for the logger.
977#[derive(Debug, Clone, PartialEq, Eq)]
978pub enum LogLevel {
979 DEBUG,
980 INFO,
981 WARN,
982 ERROR,
983}
984
985// ---- Logger (module: utils) ----
986
987/// Logger interface for ADK.
988#[derive(Debug, Clone, Default)]
989pub struct Logger {}
990
991// ---- MemoryEntry (module: memory) ----
992
993/// Represents one memory entry.
994#[derive(Debug, Clone)]
995pub struct MemoryEntry {
996 /// The content of the memory entry.
997 pub content: gemini_genai_rs::prelude::Content,
998 /// The author of the memory.
999 pub author: Option<String>,
1000 /// The timestamp when the original content of this memory happened. This string will be forwarded to LLM. Preferred format is ISO 8601 format.
1001 pub timestamp: Option<String>,
1002}
1003
1004// ---- MetadataKeys (module: a2a) ----
1005
1006#[derive(Debug, Clone, PartialEq, Eq)]
1007pub enum MetadataKeys {
1008 TYPE,
1009 LongRunning,
1010 THOUGHT,
1011}
1012
1013// ---- OAuth2Auth (module: auth) ----
1014
1015/// Represents credential value and its metadata for a OAuth2 credential.
1016#[derive(Debug, Clone, Default)]
1017pub struct OAuth2Auth {
1018 pub client_id: Option<String>,
1019 pub client_secret: Option<String>,
1020 /// tool or adk can generate the authUri with the state info thus client can verify the state
1021 pub auth_uri: Option<String>,
1022 pub state: Option<String>,
1023 /// tool or adk can decide the redirect_uri if they don't want client to decide
1024 pub redirect_uri: Option<String>,
1025 pub auth_response_uri: Option<String>,
1026 pub auth_code: Option<String>,
1027 pub access_token: Option<String>,
1028 pub refresh_token: Option<String>,
1029 pub expires_at: Option<f64>,
1030 pub expires_in: Option<f64>,
1031}
1032
1033// ---- OAuthGrantType (module: auth) ----
1034
1035/// Represents the OAuth2 flow (or grant type).
1036#[derive(Debug, Clone, PartialEq, Eq)]
1037pub enum OAuthGrantType {
1038 ClientCredentials,
1039 AuthorizationCode,
1040 IMPLICIT,
1041 PASSWORD,
1042}
1043
1044// ---- OTelHooks (module: telemetry) ----
1045
1046/// Configuration hooks for OpenTelemetry setup. This interface defines the structure for configuring OpenTelemetry components including span processors, metric readers, and log record processors.
1047#[derive(Debug, Clone, Default)]
1048pub struct OTelHooks {
1049 pub span_processors: Option<Vec<serde_json::Value>>,
1050 pub metric_readers: Option<Vec<serde_json::Value>>,
1051 pub log_record_processors: Option<Vec<serde_json::Value>>,
1052}
1053
1054// ---- OtelExportersConfig (module: telemetry) ----
1055
1056#[derive(Debug, Clone, Default)]
1057pub struct OtelExportersConfig {
1058 pub enable_tracing: Option<bool>,
1059 pub enable_metrics: Option<bool>,
1060 pub enable_logging: Option<bool>,
1061}
1062
1063// ---- ParsedVersion (module: utils) ----
1064
1065#[derive(Debug, Clone, Default)]
1066pub struct ParsedVersion {
1067 pub valid: bool,
1068 pub major: f64,
1069 pub minor: f64,
1070 pub patch: f64,
1071}
1072
1073// ---- PolicyCheckResult (module: plugins) ----
1074
1075#[derive(Debug, Clone, Default)]
1076pub struct PolicyCheckResult {
1077 pub outcome: String,
1078 pub reason: Option<String>,
1079}
1080
1081// ---- RunConfig (module: agents) ----
1082
1083/// Configs for runtime behavior of agents.
1084#[derive(Debug, Clone, Default)]
1085pub struct RunConfig {
1086 /// Speech configuration for the live agent.
1087 pub speech_config: Option<gemini_genai_rs::prelude::SpeechConfig>,
1088 /// The output modalities. If not set, it's default to AUDIO.
1089 pub response_modalities: Option<Vec<gemini_genai_rs::prelude::Modality>>,
1090 /// Whether or not to save the input blobs as artifacts.
1091 pub save_input_blobs_as_artifacts: Option<bool>,
1092 /// Whether to support CFC (Compositional Function Calling). Only applicable for StreamingMode.SSE. If it's true. the LIVE API will be invoked. Since only LIVE API supports CFC WARNING: This feature is **experimental** and its API or behavior may change in future releases.
1093 pub support_cfc: Option<bool>,
1094 /// Streaming mode, None or StreamingMode.SSE or StreamingMode.BIDI.
1095 pub streaming_mode: Option<serde_json::Value>,
1096 /// Output audio transcription config.
1097 pub output_audio_transcription: Option<serde_json::Value>,
1098 /// Input transcription for live agents with audio input from user.
1099 pub input_audio_transcription: Option<serde_json::Value>,
1100 /// If enabled, the model will detect emotions and adapt its responses accordingly.
1101 pub enable_affective_dialog: Option<bool>,
1102 /// Configures the proactivity of the model. This allows the model to respond proactively to the input and to ignore irrelevant input.
1103 pub proactivity: Option<gemini_genai_rs::prelude::ProactivityConfig>,
1104 /// Realtime input config for live agents with audio input from user.
1105 pub realtime_input_config: Option<gemini_genai_rs::prelude::RealtimeInputConfig>,
1106 /// A limit on the total number of llm calls for a given run. Valid Values: - More than 0 and less than sys.maxsize: The bound on the number of llm calls is enforced, if the value is set in this range. - Less than or equal to 0: This allows for unbounded number of llm calls.
1107 pub max_llm_calls: Option<f64>,
1108 /// If true, the agent loop will suspend on ANY tool call, allowing the client to intercept and execute tools (Client-Side Tool Execution).
1109 pub pause_on_tool_calls: Option<bool>,
1110}
1111
1112// ---- RunnerConfig (module: runner) ----
1113
1114/// The configuration parameters for the Runner.
1115// Cannot derive Clone or Default
1116pub struct RunnerConfig {
1117 /// The application name.
1118 pub app_name: String,
1119 /// The agent to run.
1120 pub agent: Arc<dyn Agent>,
1121 pub plugins: Option<Vec<serde_json::Value>>,
1122 pub artifact_service: Option<serde_json::Value>,
1123 pub session_service: serde_json::Value,
1124 pub memory_service: Option<serde_json::Value>,
1125 pub credential_service: Option<serde_json::Value>,
1126}
1127
1128// ---- SaveArtifactRequest (module: artifacts) ----
1129
1130/// The parameters for `saveArtifact`.
1131#[derive(Debug, Clone)]
1132pub struct SaveArtifactRequest {
1133 /// The app name.
1134 pub app_name: String,
1135 /// The user ID.
1136 pub user_id: String,
1137 /// The session ID.
1138 pub session_id: String,
1139 /// The filename of the artifact.
1140 pub filename: String,
1141 /// The artifact to save.
1142 pub artifact: gemini_genai_rs::prelude::Part,
1143 /// Optional custom metadata to save with the artifact.
1144 pub custom_metadata: Option<serde_json::Value>,
1145}
1146
1147// ---- SearchMemoryRequest (module: memory) ----
1148
1149/// The parameters for `searchMemory`.
1150#[derive(Debug, Clone, Default)]
1151pub struct SearchMemoryRequest {
1152 pub app_name: String,
1153 pub user_id: String,
1154 pub query: String,
1155}
1156
1157// ---- SearchMemoryResponse (module: memory) ----
1158
1159/// Represents the response from a memory search.
1160#[derive(Debug, Clone, Default)]
1161pub struct SearchMemoryResponse {
1162 /// A list of memory entries that are related to the search query.
1163 pub memories: Vec<serde_json::Value>,
1164}
1165
1166// ---- ServiceAccount (module: auth) ----
1167
1168/// Represents Google Service Account configuration.
1169#[derive(Debug, Clone, Default)]
1170pub struct ServiceAccount {
1171 pub service_account_credential: Option<serde_json::Value>,
1172 pub scopes: Option<Vec<String>>,
1173 pub use_default_credential: Option<bool>,
1174}
1175
1176// ---- ServiceAccountCredential (module: auth) ----
1177
1178/// Represents Google Service Account configuration. @example config = { type: "service_account", projectId: "your_project_id", privateKeyId: "your_private_key_id", privateKey: "-----BEGIN PRIVATE KEY-----...", clientEmail: "...@....iam.gserviceaccount.com", clientId: "your_client_id", authUri: "https://accounts.google.com/o/oauth2/auth", tokenUri: "https://oauth2.googleapis.com/token", authProviderX509CertUrl: "https://www.googleapis.com/oauth2/v1/certs", clientX509CertUrl: "https://www.googleapis.com/robot/v1/metadata/x509/...", universeDomain: "googleapis.com", }
1179#[derive(Debug, Clone, Default)]
1180pub struct ServiceAccountCredential {
1181 /// The type should be 'service_account'.
1182 pub r#type: String,
1183 /// The project ID of the Google Cloud project.
1184 pub project_id: String,
1185 /// The ID of the private key.
1186 pub private_key_id: String,
1187 /// The private key value.
1188 pub private_key: String,
1189 /// The client email.
1190 pub client_email: String,
1191 /// The client ID.
1192 pub client_id: String,
1193 /// The authorization URI.
1194 pub auth_uri: String,
1195 /// The token URI.
1196 pub token_uri: String,
1197 /// URL for auth provider's X.509 cert.
1198 pub auth_provider_x509_cert_url: String,
1199 /// URL for the client's X.509 cert.
1200 pub client_x509_cert_url: String,
1201 /// The universe domain.
1202 pub universe_domain: String,
1203}
1204
1205// ---- Session (module: sessions) ----
1206
1207/// Represents a session in a conversation between agents and users.
1208#[derive(Debug, Clone, Default)]
1209pub struct Session {
1210 /// The unique identifier of the session.
1211 pub id: String,
1212 /// The name of the app.
1213 pub app_name: String,
1214 /// The id of the user.
1215 pub user_id: String,
1216 /// The state of the session.
1217 pub state: serde_json::Value,
1218 /// The events of the session, e.g. user input, model response, function call/response, etc.
1219 pub events: Vec<serde_json::Value>,
1220 /// The last update time of the session.
1221 pub last_update_time: f64,
1222}
1223
1224// ---- StdioConnectionParams (module: tools) ----
1225
1226/// Defines the parameters for establishing a connection to an MCP server using standard input/output (stdio). This is typically used for running MCP servers as local child processes.
1227#[derive(Debug, Clone, Default)]
1228pub struct StdioConnectionParams {
1229 pub r#type: String,
1230 pub server_params: serde_json::Value,
1231 pub timeout: Option<f64>,
1232}
1233
1234// ---- StreamableHTTPConnectionParams (module: tools) ----
1235
1236/// Defines the parameters for establishing a connection to an MCP server over HTTP using Server-Sent Events (SSE) for streaming. Usage: const connectionParams: StreamableHTTPConnectionParams = { type: 'StreamableHTTPConnectionParams', url: 'http://localhost:8788/mcp' };
1237#[derive(Debug, Clone, Default)]
1238pub struct StreamableHTTPConnectionParams {
1239 pub r#type: String,
1240 pub url: String,
1241 /// Use transportOptions.requestInit.headers instead. This field will be ignored if transportOptions is provided even if no headers are specified in transportOptions.
1242 pub header: Option<serde_json::Value>,
1243 pub timeout: Option<f64>,
1244 pub sse_read_timeout: Option<f64>,
1245 pub terminate_on_close: Option<bool>,
1246 pub transport_options: Option<serde_json::Value>,
1247}
1248
1249// ---- StreamingMode (module: agents) ----
1250
1251/// The streaming mode for the run config.
1252#[derive(Debug, Clone, PartialEq, Eq)]
1253pub enum StreamingMode {
1254 NONE,
1255 SSE,
1256 BIDI,
1257}
1258
1259// ---- ThoughtEvent (module: events) ----
1260
1261/// Represents a reasoning trace (thought) from the agent.
1262#[derive(Debug, Clone, Default)]
1263pub struct ThoughtEvent {
1264 pub r#type: serde_json::Value,
1265 pub content: String,
1266}
1267
1268// ---- ToolCallEvent (module: events) ----
1269
1270/// Represents a request to execute a tool.
1271#[derive(Debug, Clone)]
1272pub struct ToolCallEvent {
1273 pub r#type: serde_json::Value,
1274 pub call: gemini_genai_rs::prelude::FunctionCall,
1275}
1276
1277// ---- ToolCallPolicyContext (module: plugins) ----
1278
1279// Cannot derive Clone or Default
1280pub struct ToolCallPolicyContext {
1281 pub tool: Arc<dyn ToolFunction>,
1282 pub tool_args: serde_json::Value,
1283}
1284
1285// ---- ToolConfirmationEvent (module: events) ----
1286
1287/// Represents a request for tool confirmation.
1288#[derive(Debug, Clone, Default)]
1289pub struct ToolConfirmationEvent {
1290 pub r#type: serde_json::Value,
1291 pub confirmations: serde_json::Value,
1292}
1293
1294// ---- ToolResultEvent (module: events) ----
1295
1296/// Represents the result of a tool execution.
1297#[derive(Debug, Clone)]
1298pub struct ToolResultEvent {
1299 pub r#type: serde_json::Value,
1300 pub result: gemini_genai_rs::prelude::FunctionResponse,
1301}
1302
1303// ---- TraceAgentInvocationParams (module: telemetry) ----
1304
1305// Cannot derive Clone or Default
1306pub struct TraceAgentInvocationParams {
1307 pub agent: Arc<dyn Agent>,
1308 pub invocation_context: serde_json::Value,
1309}
1310
1311// ---- TraceCallLlmParams (module: telemetry) ----
1312
1313#[derive(Debug, Clone, Default)]
1314pub struct TraceCallLlmParams {
1315 pub invocation_context: serde_json::Value,
1316 pub event_id: String,
1317 pub llm_request: serde_json::Value,
1318 pub llm_response: serde_json::Value,
1319}
1320
1321// ---- TraceSendDataParams (module: telemetry) ----
1322
1323#[derive(Debug, Clone)]
1324pub struct TraceSendDataParams {
1325 /// The invocation context for the current agent run.
1326 pub invocation_context: serde_json::Value,
1327 /// The ID of the event.
1328 pub event_id: String,
1329 /// A list of content objects.
1330 pub data: Vec<gemini_genai_rs::prelude::Content>,
1331}
1332
1333// ---- TranscriptionEntry (module: agents) ----
1334
1335/// Store the data that can be used for transcription.
1336#[derive(Debug, Clone)]
1337pub struct TranscriptionEntry {
1338 /// The role that created this data, typically "user" or "model". For function call, this is undefined.
1339 pub role: Option<String>,
1340 pub data: gemini_genai_rs::prelude::Blob,
1341}
1342
1343// ---- UpdateCodeExecutionResultParams (module: code_executors) ----
1344
1345/// The parameters for updating the code execution result. */
1346#[derive(Debug, Clone, Default)]
1347pub struct UpdateCodeExecutionResultParams {
1348 pub invocation_id: String,
1349 pub code: String,
1350 pub result_stdout: String,
1351 pub result_stderr: String,
1352}