Google Gemini API Agent

Overview

The Google Gemini API Agent Snap accepts input containing an initial request contents, a list of tools, and parameters to invoke an Agent execution loop. The Snap handles the call to the Google Gemini API, consumes the result and call tools, then collect them accordingly until the model has no more tools to call.

Learn more about the Agent Snap in this developer blog.


Snap dialog with fieldsets expanded on the right side

  • Read-type Snap

Prerequisites

Limitations

  • gemini-1.0-pro and gemini-1.5-pro is not supported for the Top K field.
  • models/gemini-1.5-flash is not supported for the JSON mode field.

Snap views

View Description Examples of upstream and downstream Snaps
Input This Snap supports a maximum of one binary or document input view. When the input type is a document, you must provide a field to specify the path to the input prompt. The Snap requires a prompt, which can be generated either by the Google GenAI Prompt Generator or any user-desired prompt intended for submission to the Gemini API.
Output This Snap has at the most one document output view. The Snap provides the result generated by the Gemini API. Mapper
Error

Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:

  • Stop Pipeline Execution Stops the current pipeline execution when an error occurs.
  • Discard Error Data and Continue Ignores the error, discards that record, and continues with the remaining records.
  • Route Error Data to Error View Routes the error data to an error view without stopping the Snap execution.

Learn more about Error handling in Pipelines.

Snap settings

Legend:
  • Expression icon (): Allows using JavaScript syntax to access SnapLogic Expressions to set field values dynamically (if enabled). If disabled, you can provide a static value. Learn more.
  • SnapGPT (): Generates SnapLogic Expressions based on natural language using SnapGPT. Learn more.
  • Suggestion icon (): Populates a list of values dynamically based on your Snap configuration. You can select only one attribute at a time using the icon. Type into the field if it supports a comma-separated list of values.
  • Upload : Uploads files. Learn more.
Learn more about the icons in the Snap settings dialog.
Field / Field set Type Description
Label String

Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if more than one of the same Snaps is in the pipeline.

Default value: Google Gemini API Agent

Example: Agent worker tool caller

Visualize agent flow String

Launch the Agent Visualizer UI.

Default value: N/A

Model name String/Expression/ Suggestion

Required. The model name to use for Gemini API.

Default value: N/A

Example: gemini-2.0-flash
Model location String/Expression/ Suggestion

The location of the model.

Default value: N/A

Example: us-central1
Content payload String/Expression

Required. Specify the content payload to send to the Gemini text generation endpoint for all contents. Contents coming from the Prompt Generator Snap will be correctly formatted.

Default value: N/A

Example:
[{"content":"What is the weather of San Francisco?","sl_role":"USER"}] 
Tool payload String/Expression

Required. The list of tool definitions to send to the model.

Default value: N/A

Example:
[{"sl_type":"function","name":"get_weather","description":"Get the current weather in a given location","parameters":[{"name":"city","type":"STRING","description":"The city and state, e.g. San Francisco, CA","required":false}]}]
Agent operation configuration

Modify the limitation of the Agent execution.

Iteration limit Integer/Expression

Required. The maximum iterations an agent should run.

Default value: 10

Example: 10
Monitor tool calls Checkbox

Monitor tool call parameters in pipeline statistics.

Default status: Selected

Pool size Integer/Expression

Required. The number of threads for parallel tool execution.

Default value:1

Example: 1
Reuse tool pipeline Checkbox

Reuse the tool pipeline for tool execution.

Default status: Deselected

Tool configurations

Modify the tool call settings to guide the model responses and optimize output processing.

Function calling mode Dropdown list/Expression

Required. Specifies the mode in which function calling should execute.

  • AUTO
  • ANY
  • NONE

Default value: AUTO

Example: AUTO

Allowed function names String/Expression

Required. Specify a set of function names that limit the functions the model can call.

Default value: N/A

Example:
["get_weather","get_air_pollution"]
Model parameters

Parameters used to tune the model runtime.

Top K Integer/Expression

The number of high-probability tokens considered for each generation step, controlling the randomness of the output. If left blank, the endpoint uses its default value.

Default value: N/A

Example: 20
Stop sequences String/Expression

Sequence of tokens to stop the completion at.

Default value: N/A

Example: .pay, ["amazing"], ["September", "paycheck"]
Temperature Decimal/Expression

The sampling temperature to use, a decimal value between 0 and 1. If left blank, the endpoint uses its default value.

Default value: N/A

Example: 0.2
Maximum tokens Integer/Expression

Maximum number of tokens that can be generated in the Gemini text generation foundation model. If left blank, the endpoint uses its default value.

Default value: N/A

Example: 50
Top P Decimal/Expression

The nucleus sampling value, which must be a decimal between 0 and 1. If left blank, the endpoint uses its default value.

Default value: N/A

Example: 0.2
Advanced prompt configurations

Configure the advanced prompt settings.

System prompt String/Expression

Specify the persona for the model to adopt in the responses. This initial instruction guides the LLM's responses and actions.

Default value: N/A

Example:
  • "You are a helpful assistant."
  • "You are an experienced software developer."
  • "You are a customer service representative for a tech company."
Snap execution Dropdown list
Choose one of the three modes in which the Snap executes. Available options are:
  • Validate & Execute: Performs limited execution of the Snap and generates a data preview during pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during pipeline runtime.
  • Execute only: Performs full execution of the Snap during pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Default value: Validate & Execute

Example: Execute only