GatherInfo & GatherQuestion
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.
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 name for storing the answer in global_data. Must be unique within a
single GatherInfo configuration.
The question text to present to the user.
Expected answer type. Valid values:
"string" — free-form text"number" — numeric value"boolean" — yes/no"integer" — whole numberWhen true, the model must confirm the answer with the user before
submitting it.
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.
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).
Convert the question to a dictionary for SWML generation. Fields with default values are omitted from the output.
Record<string, unknown>
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.
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.
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"process_results") — jump to that specific stepPreamble text injected once when entering the gather step. Gives the model personality and context for why it is asking these questions.
Add a question to the gather configuration. Returns this for method chaining.
Key name for storing the answer in global_data.
The question text to ask.
Answer type: "string", "number", "boolean", "integer".
Whether to confirm the answer with the user.
Extra instruction text for this question.
SWAIG function names available during this question.
GatherInfo — self, for method chaining.
Convert the gather configuration to a dictionary for SWML generation. Throws an error if no questions have been added.
Record<string, unknown>
The typical pattern is to use GatherInfo through the Step API:
You can also use GatherInfo directly: