Package com.google.genkit.ai.agent
package com.google.genkit.ai.agent
This package provides types for the Genkit agents feature, including enums and models for agent
state snapshots, agent execution lifecycle, and agent-related operations.
-
ClassDescriptionAgent<S>Agent is a bidirectional streaming agent action that manages session state and provides typed facades for snapshot retrieval and abort.AgentAbortRequest is the request body for aborting an agent execution.Builder for AgentAbortRequest.AgentAbortResponse is the response body for an agent abort operation.Builder for AgentAbortResponse.AgentApi<S>AgentApi is the typed facade interface exposed by an agent, providing snapshot retrieval, abort, identification, and chat-client creation.AgentChat<S>AgentChat is the ergonomic programmatic client for driving an agent across multiple turns while carrying session state automatically.AgentChunk<S>AgentChunk is the ergonomic wrapper
AgentChat.sendStream(java.lang.String, java.util.function.Consumer<com.google.genkit.ai.agent.AgentChunk<S>>)hands to the per-chunk callback.AgentFinishReason indicates why an agent finished execution.AgentFn<S>Custom agent handler: runs one invocation's turn loop body for ONE turn at a time via the runner.Context handed to anAgentFnfor one invocation.AgentInit<S>AgentInit represents the initialization data for an agent session.Builder for AgentInit.AgentInput represents the input to an agent turn.Builder for AgentInput.AgentInterrupt represents a tool request that paused agent execution awaiting a caller response.AgentMetadata describes the capabilities and configuration of an agent endpoint.Builder for AgentMetadata.AgentOutput<S>AgentOutput represents the output of an agent turn.Builder for AgentOutput.AgentRef is a lightweight reference to an agent, carrying only its name and description.AgentResponse is the ergonomic wrapperAgentChat.send(java.lang.String)returns for one completed turn.AgentResult represents the final result of an agent execution.Builder for AgentResult.AgentSessionContext binds aSessionto the current thread so that prompts, middleware, and tools can access the active session without passing it through every call frame.AgentStreamChunk represents a streaming chunk from an agent execution.Builder for AgentStreamChunk.AgentTransport abstracts how a single agent turn is executed.Artifact represents a named collection of content parts produced during agent execution.Builder for Artifact.ArtifactStore is a state-agnostic view of artifact storage used by middleware and tools that do not need to know the custom state typeSof the session.ClientTransform allows a client-managed agent to transform session state before returning it to the caller.Configuration for defining a custom agent viaAgentActions.defineCustomAgent.Builder forCustomAgentConfig.Disk-backed implementation ofSessionStoreandSnapshotSubscriber.Builder forFileSessionStore.Options for retrieving a session snapshot.Builder forGetSnapshotOptions.GetSnapshotRequest is the request body for retrieving a session snapshot.Builder for GetSnapshotRequest.Reference in-memory implementation ofSessionStoreandSnapshotSubscriber.RuntimeError represents a runtime error that occurred during agent execution.Builder for RuntimeError.Session<S>Session is the per-invocation in-memory state holder managed by the agent runtime.Drives ONE turn of an agent session: validates the input, appends the user message, runs the turn body, and persists a snapshot on success (SnapshotStatus.COMPLETED) or on failure (SnapshotStatus.FAILED).SessionSnapshot represents a point-in-time snapshot of an agent session.Builder for SessionSnapshot.SessionState<S>SessionState represents the state of an agent session.Builder for SessionState.SessionStore<S>Combined read/write interface for a session store.Options passed to session store operations.Builder forSessionStoreOptions.The mutator for an atomic read-modify-write on a session snapshot.Read side of a session store.SnapshotStatus represents the status of an agent snapshot.Optional capability: subscribe to a snapshot's status changes.Write side of a session store.ToolResume provides the parts needed to resume agent execution after a tool interrupt.Builder for ToolResume.TurnBody<S>The body of one agent turn.Per-turn context exposed toTurnBodyimplementations.TurnEnd signals the end of an agent turn in a streaming response.Builder for TurnEnd.