GatherInfo & GatherQuestion
GatherInfo & GatherQuestion
GatherInfo and GatherQuestion provide structured information gathering within
context steps. Instead of relying on LLM tool calls, the gather system uses
dynamic step instruction re-injection to present questions one at a time,
producing zero tool_call/tool_result entries in the LLM-visible history.
Answers are stored in global_data and can be referenced by subsequent steps
or tools.
GatherInfo is typically configured through the
Step.setGatherInfo() and
Step.addGatherQuestion()
methods rather than instantiated directly.
GatherQuestion
Represents a single question in a gather_info configuration. Each question defines a key for storing the answer, the question text, and optional validation and confirmation settings.
key
Key name for storing the answer in global_data. Must be unique within a
single GatherInfo configuration.
question
The question text to present to the user.
type
Expected answer type. Valid values:
"string"— free-form text"number"— numeric value"boolean"— yes/no"integer"— whole number
confirm
When true, the model must confirm the answer with the user before
submitting it.
prompt
Extra instruction text appended to the step prompt when this specific question is active. Use this to give the model additional context for asking or validating this question.
functions
Additional SWAIG function names to make visible while this question is active. Useful when a question requires tool access (e.g., a lookup function to validate an account number).
toDict
Convert the question to a dictionary for SWML generation. Fields with default values are omitted from the output.
Returns
Record<string, unknown>
GatherInfo
Configuration for gathering multiple pieces of information in a step. Wraps
a list of GatherQuestion objects and controls how
answers are stored and what happens after all questions are answered.
outputKey
Key in global_data under which to nest all answers. When undefined, answers
are stored at the top level of global_data using each question’s key.
completionAction
Where to navigate after all questions have been answered. Valid values:
undefined— return to normal step mode"next_step"— auto-advance to the next sequential step in the context- A step name (e.g.,
"process_results") — jump to that specific step
prompt
Preamble text injected once when entering the gather step. Gives the model personality and context for why it is asking these questions.
addQuestion
Add a question to the gather configuration. Returns this for method chaining.
Parameters
opts.key
Key name for storing the answer in global_data.
opts.question
The question text to ask.
opts.type
Answer type: "string", "number", "boolean", "integer".
opts.confirm
Whether to confirm the answer with the user.
opts.prompt
Extra instruction text for this question.
opts.functions
SWAIG function names available during this question.
Returns
GatherInfo — self, for method chaining.
toDict
Convert the gather configuration to a dictionary for SWML generation. Throws an error if no questions have been added.
Returns
Record<string, unknown>
Example
The typical pattern is to use GatherInfo through the Step API:
You can also use GatherInfo directly: