GlobalInstructionPlugin

constructor(globalInstruction: String, name: String = DEFAULT_NAME)

Creates a plugin that applies globalInstruction, filling in session state placeholders such as {user_name} for each request, as an agent's text instruction does. An instruction that resolves to an empty string leaves the request unchanged. If a placeholder names a missing state variable, beforeModel throws IllegalArgumentException unless the placeholder is marked optional, as in {nickname?}.

Parameters

name

The unique name of the plugin instance.


constructor(instructionProvider: suspend (ReadonlyContext) -> String?, name: String = DEFAULT_NAME)

Creates a plugin that applies the instruction instructionProvider returns for each request, with no placeholders filled in. A null or empty instruction leaves the request unchanged.

Parameters

name

The unique name of the plugin instance.