# Build a form with an AI agent

Ask Claude, ChatGPT, Cursor or another connected agent to build a formbase form, watch it take shape in a preview, change it, and publish it.

## Build a form with an AI agent

You describe the form in plain words; the agent builds it in your workspace as a draft and gives you a preview link. You ask for changes the same way, and publish when it looks right.

<p>
  You need an AI tool with <a href="/guides/ai-agents/connect">formbase connected</a>. The prompts below are the ones this guide was tested
  with; any wording works, as long as it says what to ask and whether to publish.
</p>

<h2 id="describe">1. Describe the form</h2>

<p>Name the form, list what it should ask, and say that it stays a draft for now:</p>

```
Build a formbase form called "[Guide] Supplier onboarding". Ask for the company name, a contact email, the company's VAT number, and whether they accept our 30-day payment terms (yes or no). Keep it as a draft and send me the preview link.
```

<p>
  The agent creates the form in the workspace you connected, adds one question at a time, and reads the form back to check the order. It
  picks a question type for each item: an email field for the contact email, a single choice for yes or no. When it is done, it replies with
  the questions it added and a preview link.
</p>

<h2 id="preview">2. Open the preview</h2>

<p>
  The preview link shows the draft as the recipient will see it, and it follows the agent's edits live, so keep it open while you ask for
  changes.
</p>

<p>
  The same form is in formbase under <strong>Forms</strong>, where you can open it in the editor and change anything by hand. What the agent
  builds is an ordinary form.
</p>

<h2 id="change">3. Ask for changes</h2>

<p>Say what to change in the same conversation, naming the questions by their titles:</p>

```
Make the VAT number optional and add a file upload for their certificate of incorporation at the end.
```

<p>The open preview shows the change as soon as the agent makes it:</p>

<p>
  Most of what you set in the editor, you can ask an agent for: required or optional, a description, choice options, conditional logic, the
  theme, translations. For long forms, ask for one part at a time and check the preview in between.
</p>

<h2 id="publish">4. Publish and get the field keys</h2>

<p>When the preview looks right, ask the agent to publish:</p>

```
Looks good. Publish it, give me the link to share, and list each question's field key.
```

<p>
  The agent publishes the form and lists the <a href="/requests/field-keys">field keys</a>. The first publish always creates a
  <a href="/sharing-publishing/sharing-embedding#share-links">share link</a> anyone can open, and the agent gives it to you. An agent reads
  the keys from the published form, so asked before you publish, it says it cannot list them yet.
</p>

<p>
  Each key comes from the question's title: <em>Company name</em> becomes <code>company_name</code>. Keys are how a request prefills a
  question and how the answers come back, and they <a href="/requests/field-keys#freeze">stay the same</a> when you later rename a question.
  An agent cannot choose a key. To shorten a long one, edit it in the editor's
  <a href="/requests/field-keys#where">Keys table</a>, best before the first publish, while no automation uses it yet.
</p>

> ℹ️ **Publishing makes the form live**
> <p>
>     Once published, anyone with the share link can submit the form. To take answers only from named people, ask the agent to revoke the
>     share link and <a href="/guides/ai-agents/send-a-request">send requests</a> instead.
>   </p>

<h2 id="next">Next</h2>

<div class="not-prose grid gap-3 sm:grid-cols-2 mb-8">
  - [Send a request with an AI agent](/guides/ai-agents/send-a-request) — Ask one person to complete the form, prefilled, and read their answers back.
  - [Field types](/building-forms/field-types) — Every question type an agent can add.
</div>
