GlobalInstructionPlugin
Prepends an app-wide instruction (such as a common identity or set of rules) to the system instruction of every model request so all agents in the app share it. Mirrors Python ADK's GlobalInstructionPlugin.
val company = GlobalInstructionPlugin("You work for Acme.")
val rules = GlobalInstructionPlugin({ context -> loadRules(context.userId) }, name = "rules")
InMemoryRunner(agent = agent, plugins = listOf(company, rules))Constructors
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?}.
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.
Properties
Functions
Callback executed after a specific agent finishes its processing.
Callback executed after an LLM response is received.
Callback executed after the ADK runner completes its execution.
Callback executed before a specific agent starts processing.
Callback executed before an LLM request is sent.
Callback executed before the ADK runner starts the main execution loop.
Callback executed before a tool is invoked.
Callback executed when an event is yielded by an agent during execution.
Callback executed when an error occurs during an LLM interaction.
Callback executed when an unhandled error escapes the ADK runner run.
Callback executed when an error occurs during a tool invocation.
Callback executed when a user message is received before an invocation starts.