Interface Instruction
- All Known Implementing Classes:
Instruction.Provider
,Instruction.Static
In the instructions, you should describe concisely what the agent will do, when it should defer to other agents/tools, and how it should respond to the user.
Templating is supported using placeholders like {variable_name}
or
{artifact.artifact_name}
. These are replaced with values from the agent's session state or
loaded artifacts, respectively. For example, an instruction like "Translate the following
text to {language}: {user_query}"
would substitute {language}
and {user_query}
with their corresponding values from the session state.
Instructions can also be dynamically constructed using Instruction.Provider
. This
allows for more complex logic where the instruction text is generated based on the current ReadonlyContext
. Additionally, an instruction could be built to include specific information
based on based on some external factors fetched during the Provider call like the current time,
the result of some API call, etc.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
Returns an instruction dynamically constructed from the given context.static final record
Plain instruction directly provided to the agent.