instructionutil

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package instructionutil provides utilities to work with agent instructions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InjectSessionState

func InjectSessionState(ctx agent.ReadonlyContext, template string) (string, error)

InjectSessionState populates values in the instruction template, e.g. state, artifact, etc.

  • There can be placeholders like {key_name} that will be resolved by ADK at runtime using session state and context.
  • key_name must match "^[a-zA-Z_][a-zA-Z0-9_]*$", otherwise it will be treated as a literal.
  • {artifact.key_name} can be used to insert the text content of the artifact named key_name.

If the state variable or artifact does not exist, the agent will raise an error. If you want to ignore the error, you can append a ? to the variable name as in {var?}.

This method is intended to be used in InstructionProvider based Instruction and GlobalInstruction which are called with ReadonlyContext.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL