> For the complete documentation index, see [llms.txt](https://help.metaforms.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.metaforms.ai/survey-programming-dimensions/programming-with-ai.md).

# Programming with AI

MetaForms includes a built-in AI agent that helps you program survey questions, quotas, and logic directly from the Build interface. You can interact with it through the chat panel or use the inline Generate widget for quick edits.

***

### Programming Questions via AI Assistant

**Step 1:** Ask the agent to program questions — for example, *"Program the first five questions from the questionnaire"* (or specify any section or range).

![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-83e25dddebec4bef498b9396371f4e80ca5a1794%2Fclueso-862f500b-3938-438d-b2ac-1ef0186b1cab.png?alt=media)

**Step 2:** The agent updates your metadata and routing code based on your request. Review the proposed changes in the script panel on the left.

![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-1a9e4f937d4f5b558cd7c54a48b9fcf4ecd35242%2Fclueso-1d9d4001-b242-4c9f-9665-130d6b13ca2e.png?alt=media)

**Step 3:** Click **Accept All** or **Reject All** to finalize or dismiss the changes. Make sure to apply your decision in both the **Metadata** and **Routing** tabs.

![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-552f0727f988a1ea6687f029e806d09bb3e5b1f9%2Fclueso-35137e21-4d58-4487-b2e6-9be27ea048a9.png?alt=media)

***

### Programming Quotas

**Step 4:** To generate quotas, ask the agent in a new or existing chat — for example, *"Program quotas based on the given QNR."*

![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-13805938b7bba83de22851af892e11a2411dc6ee%2Fclueso-015359d2-6992-45f0-aac7-63e0cad3f747.png?alt=media)

**Step 5:** Review and accept the agent's changes as before. Once accepted, the **Quotas** panel at the top will display the generated tables

![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-35b8cdc6e6bea8404204f088d37a6005bc088032%2Fclueso-b861d2c6-446b-4ad7-8a0d-87c484943c46.png?alt=media)

<figure><img src="https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-bb419d79957c569202a885d529d07a840aa4b9d5%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

***

### Inline Editing with the Widget

For quick, targeted edits you can use the inline widget.

**Step 6:** Hover over any line in the script. Two options appear:

* **Generate** (on an empty line) — asks the agent to write new code at that position.

  You'll also have the option to select the number of questions to generate at a time between 3, 5 and 10.

<figure><img src="https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-be82560eee0c563c11ea586d83002b367abdad34%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

* **Edit** (incase a set of lines are selected) — asks the agent to modify the selected code. Type your request into the chat and the agent will propose changes inline.

![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-f42004c93f47534933ed1007154aeda4a6434a69%2Fclueso-1b03a347-f3b6-4038-8796-4302e1dc9a3a.png?alt=media)

**Step 7:** Review and **Accept** or **Reject** the inline changes, just like you would with chat-generated edits.

***

### Tips

* Use the **Design File** panel on the right as a reference while you prompt the agent — it shows your original questionnaire.
* Navigate between the **script**, **design file**, and **AI assistant** panels to cross-check your updates.
* Save a **checkpoint** before making large changes so you can roll back if needed.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.metaforms.ai/survey-programming-dimensions/programming-with-ai.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
