/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import { Content } from '@google/genai'; import { BaseAgent } from '../agents/base_agent.js'; import { Context } from '../agents/context.js'; import { InvocationContext } from '../agents/invocation_context.js'; import { Event } from '../events/event.js'; import { LlmRequest } from '../models/llm_request.js'; import { LlmResponse } from '../models/llm_response.js'; import { BaseTool } from '../tools/base_tool.js'; import { BasePlugin } from './base_plugin.js'; /** * A plugin that logs important information at each callback point. * * This plugin helps printing all critical events in the console. It is not a * replacement of existing logging in ADK. It rather helps terminal based * debugging by showing all logs in the console, and serves as a simple demo for * everyone to leverage when developing new plugins. * * This plugin helps users track the invocation status by logging: * - User messages and invocation context * - Agent execution flow * - LLM requests and responses * - Tool calls with arguments and results * - Events and final responses * - Errors during model and tool execution * * Example: * ```typescript * const loggingPlugin = new LoggingPlugin(); * const runner = new Runner({ * agents: [myAgent], * // ... * plugins: [loggingPlugin], * }); * ``` */ export declare class LoggingPlugin extends BasePlugin { /** * Initialize the logging plugin. * * @param name The name of the plugin instance. */ constructor(name?: string); onUserMessageCallback({ invocationContext, userMessage, }: { invocationContext: InvocationContext; userMessage: Content; }): Promise; beforeRunCallback({ invocationContext, }: { invocationContext: InvocationContext; }): Promise; onEventCallback({ event, }: { invocationContext: InvocationContext; event: Event; }): Promise; afterRunCallback({ invocationContext, }: { invocationContext: InvocationContext; }): Promise; beforeAgentCallback({ callbackContext, }: { agent: BaseAgent; callbackContext: Context; }): Promise; afterAgentCallback({ callbackContext, }: { agent: BaseAgent; callbackContext: Context; }): Promise; beforeModelCallback({ callbackContext, llmRequest, }: { callbackContext: Context; llmRequest: LlmRequest; }): Promise; afterModelCallback({ callbackContext, llmResponse, }: { callbackContext: Context; llmResponse: LlmResponse; }): Promise; beforeToolCallback({ tool, toolArgs, toolContext, }: { tool: BaseTool; toolArgs: Record; toolContext: Context; }): Promise | undefined>; afterToolCallback({ tool, toolContext, result, }: { tool: BaseTool; toolArgs: Record; toolContext: Context; result: Record; }): Promise | undefined>; onModelErrorCallback({ callbackContext, error, }: { callbackContext: Context; llmRequest: LlmRequest; error: Error; }): Promise; onToolErrorCallback({ tool, toolArgs, toolContext, error, }: { tool: BaseTool; toolArgs: Record; toolContext: Context; error: Error; }): Promise | undefined>; private log; private formatContent; private formatArgs; }