define_contexts
define_contexts
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.
When called with an argument, sets the context configuration directly and returns
self. When called without arguments, returns a
ContextBuilder for fluent
context definition.
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
Context configuration. Pass a dictionary or ContextBuilder to set contexts
directly. Omit to receive a ContextBuilder for fluent definition.
Returns
AgentBase — When contexts is provided.
ContextBuilder — When called
with no arguments.