adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
49 lines (48 loc) • 1.74 kB
TypeScript
import { InvocationContext } from "../agents/InvocationContext";
import { CodeExecutionInput, CodeExecutionResult } from "./codeExecutionUtils";
/**
* Abstract base class for all code executors.
*
* The code executor allows the agent to execute code blocks from model responses
* and incorporate the execution results into the final response.
*/
export declare abstract class BaseCodeExecutor {
/**
* If true, extract and process data files from the model request
* and attach them to the code executor.
* Supported data file MimeTypes are [text/csv].
*
* Default to false.
*/
optimizeDataFile: boolean;
/**
* Whether the code executor is stateful. Default to false.
*/
stateful: boolean;
/**
* The number of attempts to retry on consecutive code execution errors. Default to 2.
*/
errorRetryAttempts: number;
/**
* The list of the enclosing delimiters to identify the code blocks.
* For example, the delimiter ['```python\n', '\n```'] can be
* used to identify code blocks with the following format:
*
* ```python
* print("hello")
* ```
*/
codeBlockDelimiters: [string, string][];
/**
* The delimiters to format the code execution result.
*/
executionResultDelimiters: [string, string];
/**
* Executes code and return the code execution result.
*
* @param invocationContext - The invocation context of the code execution.
* @param codeExecutionInput - The code execution input.
* @returns The code execution result.
*/
abstract executeCode(invocationContext: InvocationContext, codeExecutionInput: CodeExecutionInput): Promise<CodeExecutionResult>;
}