BigQueryAgentAnalyticsPlugin

An ADK Plugin that records agent execution events to a BigQuery table. If the destination table does not exist, the plugin automatically creates and configures the partitioned table on first use. Rows are queued and written in the background in batches with the BigQuery Storage Write API; call close when done to write the rows still queued.

Constructors

Link copied to clipboard
constructor(config: BigQueryLoggerConfig, bigQuery: BigQuery = createBigQuery(config), ioContext: CoroutineContext = Dispatchers.IO, timeSource: TimeSource = TimeSource.Monotonic)

Creates a plugin that logs to the table config names.

Types

Link copied to clipboard
class Builder

Fluent builder for BigQueryAgentAnalyticsPlugin, 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
open override val name: String

Functions

Link copied to clipboard
open suspend override fun afterAgent(context: CallbackContext): CallbackChoice<Unit, Content>
Link copied to clipboard
open suspend override fun afterModel(context: CallbackContext, response: LlmResponse): LlmResponse
Link copied to clipboard
open suspend override fun afterRun(invocationContext: InvocationContext)
Link copied to clipboard
open suspend override fun afterTool(context: ToolContext, tool: BaseTool, args: Map<String, Any?>, result: Map<String, Any?>): Map<String, Any?>
Link copied to clipboard
open suspend override fun beforeAgent(context: CallbackContext): CallbackChoice<EventActions, Content>
Link copied to clipboard
open suspend override fun beforeModel(context: CallbackContext, request: LlmRequest): CallbackChoice<LlmRequest, LlmResponse>
Link copied to clipboard
open suspend override fun beforeRun(invocationContext: InvocationContext): CallbackChoice<Unit, Content>
Link copied to clipboard
open suspend override fun beforeTool(context: ToolContext, tool: BaseTool, args: Map<String, Any?>): CallbackChoice<Map<String, Any?>, Map<String, Any?>>
Link copied to clipboard
open override fun close()

Writes the rows still queued, waiting up to BigQueryLoggerConfig.shutdownTimeout, and releases the write client. The next row logged starts a new one.

Link copied to clipboard
suspend fun flush()

Waits until every row logged before the call is written to BigQuery or dropped.

Link copied to clipboard

Returns how many rows were dropped so far for each reason, such as queue_full or retry_exhausted. Every reason is listed, even one with no drops.

Link copied to clipboard
open suspend override fun onEvent(invocationContext: InvocationContext, event: Event): Event
Link copied to clipboard
open suspend override fun onModelError(context: CallbackContext, request: LlmRequest, error: Throwable): CallbackChoice<Unit, LlmResponse>
Link copied to clipboard
open suspend override fun onRunError(invocationContext: InvocationContext, error: Throwable)
Link copied to clipboard
open suspend override fun onToolError(context: ToolContext, tool: BaseTool, args: Map<String, Any?>, error: Throwable): CallbackChoice<Unit, Map<String, Any?>>
Link copied to clipboard
open suspend override fun onUserMessage(invocationContext: InvocationContext, userMessage: Content): Content