Creating Dynamic User Inputs

Learn to dynamically render user choices, gather additional context interactively, and enhance decision-making within your AI agents.

Dynamic user inputs allow your AI workflows to adapt and respond to earlier outputs by presenting users with choices or prompts that reflect prior data. This approach makes your AI agents more interactive, relevant, and powerful.

Scenario: Extracting Entities from a Scraped URL

In a basic setup, you might scrape a URL and extract entities (e.g., people, organizations) mentioned in an article. The next step could involve presenting the user with these entities to choose one for further research.

To do this:

  1. Use a Generate Text block to return a list of entities in a specific JSON format.

  2. The JSON should be an array of objects, each with label and subtitle keys:

    jsonCopyEdit[
      { "label": "NASA", "subtitle": "Space agency mentioned in article" },
      { "label": "SpaceX", "subtitle": "Private aerospace company" }
    ]
  3. Save this as a variable, e.g., entities.

Adding a Dynamic User Input Block

  1. Add a User Input block.

  2. Select Text Choice.

  3. Set the prompt (e.g., "Which entity would you like to research further?").

  4. Under Dynamic Source, specify the variable holding your JSON (e.g., entities).

  5. The selected label will be stored as the input value.

This enables workflows to dynamically populate input options based on AI-generated data.

Advanced Use Case: Refining Research Topics

Sometimes user input is too broad (e.g., just entering "dogs"). To handle this, MindStudio offers a User Context block to gather deeper context through AI-generated questions.

How It Works:

  1. Collect a general topic input from the user.

  2. Use a User Context block:

    • Set the topic as input.

    • Provide a prompt like: "Help the user refine the topic they’d like to research. Gather more contextual information in order to perform a full research report."

    • Choose the Interview Depth (Quick, Medium, or Thorough).

    • Set a Maximum Question Limit.

    • Save the results in a variable, e.g., topicDetails.

  3. Use topicDetails downstream to:

    • Generate refined search queries

    • Provide detailed context to summarization or report-generation blocks

This results in much more specific, targeted output.

Example: Deep Research Agent Flow

  1. Collect topic from the user.

  2. Run a User Context block to gather more details.

  3. Use topicDetails to generate Google search queries.

  4. Scrape and summarize each result in sub-workflows.

  5. Aggregate findings and generate a detailed report.

This method creates highly accurate and contextual results.

Benefits of Dynamic Inputs

  • User-Adaptive: Tailors the experience based on AI or previous input

  • Flexible: Works with structured JSON or free-text context

  • Scalable: Enables detailed processing of dynamic lists or open-ended tasks

Summary

Use dynamic user inputs when:

  • The user's next step should be informed by previous AI outputs

  • You need to collect deeper, more relevant context

  • You want to make AI workflows more flexible and responsive

Dynamic inputs are essential for building smart, adaptive AI agents that can guide users and gather meaningful context in real time.

Last updated