VertexAiSearchTool

class VertexAiSearchTool(val dataStoreId: String? = null, val dataStoreSpecs: List<VertexAISearchDataStoreSpec>? = null, val searchEngineId: String? = null, val filter: String? = null, val maxResults: Int? = null, val bypassMultiToolsLimit: Boolean = false) : BaseTool

A built-in tool using Vertex AI Search.

This tool can be configured with either a dataStoreId (the Vertex AI search data store resource ID) or a searchEngineId (the Vertex AI search engine resource ID).

Constructors

Link copied to clipboard
constructor(dataStoreId: String? = null, dataStoreSpecs: List<VertexAISearchDataStoreSpec>? = null, searchEngineId: String? = null, filter: String? = null, maxResults: Int? = null, bypassMultiToolsLimit: Boolean = false)

Types

Link copied to clipboard
class Builder

Fluent builder for VertexAiSearchTool, provided primarily for Java callers. Any property left unset falls back to the same default as the constructor.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

How a live run declares this tool to the model: Behavior.NON_BLOCKING lets the model keep the conversation going while a call is pending, Behavior.BLOCKING makes it wait for the response, and Behavior.UNSPECIFIED, or null without a responseScheduling, leaves the tool's declaration as it is. Override it with Behavior.NON_BLOCKING on a tool whose run returns a Flow; a tool that doesn't stream still runs to completion before the live run reads the model's next message. A com.google.adk.kt.annotations.Tool function returning a Flow, or a BasePublisherTool, is declared non-blocking without it.

Link copied to clipboard

When true, allows this built-in tool to be used alongside other tools: it is exposed as a function tool (see VertexAiSearchAgentTool) since built-in tools cannot otherwise be combined with other tools in a single request.

Link copied to clipboard

The custom metadata of the tool.

Link copied to clipboard

The Vertex AI search data store resource ID in the format of projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}.

Link copied to clipboard

Specifications that define the specific DataStores to be searched. It should only be set if engine is used.

Link copied to clipboard

The description of the tool.

Link copied to clipboard

The filter to apply to the search results.

Link copied to clipboard

Whether the tool's final result will be delivered out-of-band. When true, the framework marks the call as long-running and uses the tool's return value as the function-response payload. Returning Unit means "no response yet": the FR event is suppressed so the function-call event (which carries the call id in longRunningToolIds and is thus the turn's final response) ends the turn without re-invoking the model. A non-Unit return -- including an explicit empty Map -- is treated as a real response and emitted. (Unit suppression aligns with Python; Java instead always emits {}.) The longRunningToolIds id also drives the resumable-mode pause gate so the invocation can be resumed later via a user-injected function-response.

Link copied to clipboard
open val isStreaming: Boolean = false

Overridden by the framework's generated, reflective and publisher-based tools, which always stream in a live run, so a live run can declare them non-blocking before they run. For framework use only; it may change without notice.

Link copied to clipboard

The maximum number of results to return.

Link copied to clipboard

The name of the tool.

Link copied to clipboard

When a live model reacts to this tool's responses: FunctionResponseScheduling.SILENT only adds them to its context, FunctionResponseScheduling.WHEN_IDLE reacts once the model is idle, and FunctionResponseScheduling.INTERRUPT reacts at once. A streaming tool can choose differently for one value by emitting a com.google.adk.kt.types.FunctionResponse that sets scheduling. With a null behavior, a tool that sets it is declared non-blocking in a live run.

Link copied to clipboard

The Vertex AI search engine resource ID in the format of projects/{project}/locations/{location}/collections/{collection}/engines/{engine}.

Functions

Link copied to clipboard
fun BaseTool.asNode(name: String = this.name, config: NodeConfig = NodeConfig()): Node

Returns a workflow node that runs this tool as a fixed step: the predecessor's output becomes the tool's arguments, and the tool's result becomes the node's output.

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun declaration(): FunctionDeclaration?

Returns the underlying function declaration.

Link copied to clipboard
open suspend override fun processLlmRequest(toolContext: ToolContext, llmRequest: LlmRequest): LlmRequest

Processes the LLM request before it is sent.

Link copied to clipboard
open suspend override fun run(context: ToolContext, args: Map<String, Any?>): Any

Executes the tool and returns its result.