defineContexts
Define contexts and steps for multi-step conversation workflows. Contexts allow an agent to guide the caller through a structured sequence of interactions — such as gathering information, verifying identity, and then performing an action.
Returns a ContextBuilder for fluent context definition. If an
existing ContextBuilder instance is passed, it is used directly. Otherwise a new
empty ContextBuilder is created and returned.
Contexts can coexist with traditional prompts. The only restriction is that POM sections and raw text cannot be mixed in the main prompt.
Parameters
contexts
An existing ContextBuilder instance to use directly. If omitted or a plain object
is passed, a new empty ContextBuilder is created instead.
Returns
ContextBuilder — The active ContextBuilder for further configuration.
Examples
Fluent ContextBuilder
addStep() is a method on Context, not on Step. Since Step methods like
setValidSteps() return the Step (not the parent Context), you must keep a
reference to the Context and call addStep() on it for each new step.