> For the complete documentation index, see [llms.txt](https://docs.distro.so/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.distro.so/data-and-integrations/ai.md).

# AI and web research

Use AI steps when the next action needs a judgment, summary, or structured findings that your existing fields do not provide.

Keep deterministic business rules in Branch and rulebooks when their inputs already answer the question.

## AI Prompt

Connect the model provider under **Settings → Integrations → AI**, then add **AI Prompt**.

Choose the supported model, insert only the inputs needed for the task, and write a clear **Prompt**.

Under **Output**, choose **Text** for a message or summary, or **Structured fields** when later steps need typed values.

For example, define a text category and a short explanation, then branch on the returned category. Configure the allowed values in the structured schema where supported.

Use the data picker to insert upstream fields. A prompt does not automatically see your entire CRM.

## Handle failure

Review **If the prompt fails**.

Choose to stop and use the error path, or continue with empty outputs where your flow has a fallback. If continuing, check the returned failure value before relying on a missing result.

Do not route a lead to a specialized team solely because an empty result falls through a negative condition.

## Web Research

Connect the research provider, add **Web Research**, and configure the person or company inputs, research request, and output fields.

Use the findings in later steps. Research can take longer than a simple lookup, so consider whether it belongs before the immediate scheduler response or in later follow-up.

## Test the decision

Use representative samples in simulation, including incomplete and ambiguous cases.

Then use controlled live examples to check the provider output. Review the underlying information before letting an AI result overwrite an important CRM field or determine a consequential action.

A human approval step can review a result before the action is sent.

## Provider usage

AI and research calls use the connected provider account. Model availability, permissions, and billing are managed through that connection.

See [Logic and human steps](/workflows/logic.md) and [Integration availability](/data-and-integrations/availability.md).


---

# 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 dynamically by asking a question.

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

```
GET https://docs.distro.so/data-and-integrations/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 `build a script that syncs our docs to a CMS` 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.
