Skip to content
A flat 2D digital drawing shows a stylized computer terminal interface in a simple, 8-bit style using five colors. It includes three geometric elements: a yes/no dialog box with check and x icons, a plain input field, and a vertical list with one highlighted selection. The design features clean lines and a solid color setting with no background details or human figures, all within a 128 by 128 pixel square.

User Input

GenAIScript provides various functions to get user input in a script execution. This is useful to create “human-in-the-loop” experience in your scripts.

When running the CLI, the user input is done through the terminal.

Asks a question to the user and waits for a yes/no answer. It returns a boolean.

true/false
const ok = await host.confirm("Do you want to continue?")

Asks a question to the user and waits for a text input. It returns a string.

const name = await host.input("What is your name?")

Asks a question to the user and waits for a selection from a list of options. It returns a string.

const choice = await host.select("Choose an option:", [
"Option 1",
"Option 2",
"Option 3",
])

User input functions return undefined when running in CI environments.