ContextBuilder
ContextBuilder is the top-level container for defining structured conversation
workflows. It holds one or more Context
objects, each containing a sequence of Step
objects. Use it when your agent needs guided, multi-step conversations instead of
free-form prompting.
Access the builder by calling defineContexts() on an
AgentBase instance. The builder
validates the entire context tree when the SWML document is rendered.
You rarely create a ContextBuilder directly. Call defineContexts() inside
your agent class, which creates the builder and wires it into SWML generation
automatically.
Methods
Create a new named context and add it to the builder.
Retrieve an existing context by name.
Convert all contexts to a dictionary for SWML generation.
Validate the entire context configuration tree.