validate
Validate the entire context configuration. Called automatically during SWML rendering, but can be called manually to catch errors early.
Checks performed:
- At least one context exists.
- A single context is named
"default". - Every context has at least one step.
- All step-level
valid_stepsreferences point to steps that exist within the same context (the special value"next"is always allowed). - All
valid_contextsreferences at the context level point to contexts that exist in the builder. - All
valid_contextsreferences at the step level point to contexts that exist in the builder. - Every context’s
initial_step, when set, names a step in that context. - All
gather_infoconfigurations have at least one question, no duplicate keys, and validcompletion_actiontargets. - When the builder is attached to an agent, no user-defined tool shares a name
with a reserved native tool (
next_step,change_context,gather_submit). - When the builder is attached to an agent, every name a step passes to
set_functions([...])is a registered SWAIG tool or a reserved native tool. A name that matches neither would render a dangling function reference."none"and[]mean “disable all” and are never treated as references.
Returns
None — Raises ValueError with a descriptive message if validation fails.