kernl

Class: Toolkit<TContext>

Defined in: packages/kernl/src/tool/toolkit.ts:85

A toolkit containing static function tools.

Example

const fs = new FunctionToolkit({
  id: "fs",
  tools: [readFile, writeFile, listDir, ...]
});

Extends

  • BaseToolkit<TContext>

Type Parameters

Type ParameterDefault type
TContextUnknownContext

Constructors

Constructor

new Toolkit<TContext>(config: FunctionToolkitConfig<TContext>): FunctionToolkit<TContext>;

Defined in: packages/kernl/src/tool/toolkit.ts:97

Create a new function toolkit.

Parameters

ParameterTypeDescription
configFunctionToolkitConfig<TContext>Toolkit configuration with id and tools array

Returns

FunctionToolkit<TContext>

Overrides

BaseToolkit<TContext>.constructor

Properties

PropertyModifierTypeDescriptionOverridesInherited fromDefined in
agent?protectedBaseAgent<any, "text">The agent this toolkit is bound to (if any). Uses any to allow toolkits with different context types to be composed in the same agent.-BaseToolkit.agentpackages/kernl/src/tool/toolkit.ts:37
descriptionreadonlystringDescription of what this toolkit providesBaseToolkit.description-packages/kernl/src/tool/toolkit.ts:89
idreadonlystringUnique identifier for this toolkitBaseToolkit.id-packages/kernl/src/tool/toolkit.ts:88

Methods

bind()

bind(agent: BaseAgent<any>): void;

Defined in: packages/kernl/src/tool/toolkit.ts:43

Bind this toolkit to an agent. Called by agent constructor.

Parameters

ParameterType
agentBaseAgent<any>

Returns

void

Inherited from

BaseToolkit.bind

destroy()

destroy(): Promise<void>;

Defined in: packages/kernl/src/tool/toolkit.ts:69

Cleanup resources held by this toolkit. Override if your toolkit needs cleanup (e.g., closing connections). Default implementation does nothing.

Returns

Promise<void>

Inherited from

BaseToolkit.destroy

get()

get(id: string): Tool<TContext> | undefined;

Defined in: packages/kernl/src/tool/toolkit.ts:110

Get a specific tool by ID.

Parameters

ParameterTypeDescription
idstringThe tool ID to look up

Returns

Tool<TContext> | undefined

The tool if found, undefined otherwise

Overrides

BaseToolkit.get

list()

list(context?: Context<TContext>): Promise<Tool<TContext>[]>;

Defined in: packages/kernl/src/tool/toolkit.ts:120

List all tools in this toolkit.

Parameters

ParameterTypeDescription
context?Context<TContext>Optional context for filtering tools (currently unused)

Returns

Promise<Tool<TContext>[]>

Array of all tools in this toolkit

Overrides

BaseToolkit.list

On this page