Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.narada.ai/llms.txt

Use this file to discover all available pages before exploring further.

The prompt_for_user_input method shows a form in the Narada browser UI and waits for the user to provide values for one or more workflow variables. Use this when a Python agent needs structured input before it can continue.
For a higher-level guide covering both human-in-the-loop methods, see Human-in-the-Loop Steps.

Method Signature

async def prompt_for_user_input(
    self,
    *,
    step_id: str,
    variables: list[PromptForUserInputVariable],
    timeout: int | None = None,
) -> dict[str, Any]

Parameters

step_id
str
required
A stable identifier for this prompt step.
step_id="collect-report-filters"
variables
list[PromptForUserInputVariable]
required
The variables to ask the user to fill. Each variable has:
  • name: variable name
  • type: one of string, number, boolean, enum, dataTable, object, or array
  • required: whether the user must provide a value
  • enum_values: allowed values for enum variables
variables=[
    {"name": "region", "type": "enum", "required": True, "enum_values": ["west", "east"]},
    {"name": "max_accounts", "type": "number", "required": True},
    {"name": "notes", "type": "string", "required": False},
]
timeout
int | None
default:"None"
Maximum time in seconds to wait for the user response. If omitted, Narada uses the default extension action timeout of 15 seconds.

Return Value

Returns a dictionary keyed by variable name:
{
    "region": "west",
    "max_accounts": 25,
}
Optional variables may be omitted if the user leaves them blank. If the interaction is cancelled or aborted, the method raises UserAbortedError. For dataTable variables, returned values use the canonical table shape:
{
    "columnNames": ["Name", "Email"],
    "rows": [
        ["Ada Lovelace", "ada@example.com"],
        ["Grace Hopper", "grace@example.com"],
    ],
}

Example

import asyncio
from narada import Narada, UserAbortedError

async def main():
    async with Narada() as narada:
        window = await narada.open_and_initialize_browser_window()

        try:
            values = await window.prompt_for_user_input(
                step_id="collect-search-options",
                variables=[
                    {"name": "search_query", "type": "string", "required": True},
                    {"name": "max_results", "type": "number", "required": True},
                    {
                        "name": "source",
                        "type": "enum",
                        "required": False,
                        "enum_values": ["web", "crm", "docs"],
                    },
                ],
                timeout=300,
            )
        except UserAbortedError:
            print("The prompt was cancelled.")
            return

        response = await window.agent(
            prompt=(
                f"Search {values.get('source', 'web')} for "
                f"{values['search_query']} and return the top {values['max_results']} results."
            )
        )
        print(response.output.content)

if __name__ == "__main__":
    asyncio.run(main())