1. Template Techniques
  2. Generate and Prefill a Public Form

Template Techniques

Generate and Prefill a Public Form

Explains how an AI agent can generate a unique public form link, prefill known data, and continue after submission.

Use this technique when:

  • more than a few fields are needed
  • the user needs to select from lots of options
  • there are conditional field requirements
  • use of a complex (non-ai) field is needed (eg. a signature field)

Then a good technique to use is public form generate and prefill.

Structure

It consists of two actions; their names are flexible:

  1. A generate (generate_form_link) action, which is an AI enabled action that collects some key fields that allow personalization of the form and prefilling some data
  2. A submit (submit_[description]) action, which is a public forms enabled action (non-AI) that is run when the user submits the form (which triggers the action)
  • the generate action should use the same field name as the submit action for prefilled fields so that they will be auto saved in stub.data and the used to prefill the data in the public form
  • the submit action action_meta.clear_action_data setting should be false to allow prefilling the form
  • the public form will be available on the specific stub so it will be unique to the conversation and not a "general" form shared by users
  • submitting the form will trigger the submit action
  • the form submit action could transition state
  • the form submit should inject a system message to the agent to notify the AI agent to continue the process