# Contract Autopilot

{% hint style="success" icon="database" %}
Contract Autopilot is currently available as a **preview** feature. Contact <support@soda.io> for early access.
{% endhint %}

**Contract Autopilot** automatically generates initial data contracts for datasets with **recommended data quality checks** to accelerate onboarding in Soda Cloud. It is designed to help teams achieve **fast time to value** and iterate later.

#### <i class="fa-camcorder">:camcorder:</i> Watch Contract Autopilot in action

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA2PmHkO5cBgeRPdiPPOG%2Fuploads%2Fi8AsE1XrAzUpzDViJHQA%2Fautopilot%20demo.mp4?alt=media&token=a806f6eb-77e3-484b-ade0-e47c23a5f3bc>" %}

#### :bulb: Contract Autopilot vs. Create Contract

{% columns %}
{% column %}
**Contract Autopilot** analyzes sampled data and profiling metadata to automatically generate a **fully populated contract with recommended checks**.
{% endcolumn %}

{% column %}
When you click **Create Contract** (or use the CLI `generate` command), Soda creates a **contract skeleton** based on the dataset schema. It includes columns only and **no checks are added**.
{% endcolumn %}
{% endcolumns %}

## Generate a contract with Autopilot

{% hint style="warning" %}
This feature requires the **Manage contract** permission on the select datasets. Learn more about permissions here: [dataset-attributes-and-responsibilities](https://docs.soda.io/dataset-attributes-and-responsibilities "mention")
{% endhint %}

{% stepper %}
{% step %}

#### Select datasets

On the **Datasets** page, select the datasets for which you want to generate a contract.

Then, click on **Generate Contracts** (top right).

<figure><img src="https://1123167021-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA2PmHkO5cBgeRPdiPPOG%2Fuploads%2FX1smive3w5HMHy3A1LQU%2Fimage.png?alt=media&#x26;token=08dfcc4c-71f7-47af-863f-d4345b9a0f90" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### \[Optional] Set a schedule for contracts

You can optionally define a schedule to run contract verification at a time of your choosing.

<figure><img src="https://1123167021-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA2PmHkO5cBgeRPdiPPOG%2Fuploads%2FmV2DTk1GuXAl3RGoDP5H%2Fimage.png?alt=media&#x26;token=dd472cfe-a2e9-49c9-b7d4-f868798a756d" alt="" width="560"><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Generate

After selecting the datasets, Soda will provide a snapshot of which contracts will be generated, and a time estimate for generation. You can continue using Soda Cloud while contracts are being generated.

After reviewing what will be created, click on **Generate `[num]` Contracts**.

<figure><img src="https://1123167021-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FA2PmHkO5cBgeRPdiPPOG%2Fuploads%2FkWateFFOa3zYEfbP6kLa%2Fimage.png?alt=media&#x26;token=6bb28393-fb30-4bdb-9156-fd7d687284dd" alt=""><figcaption></figcaption></figure>

<i class="fa-octagon-check">:octagon-check:</i> You can now **view the generated contracts** to review, edit or suggest changes.
{% endstep %}
{% endstepper %}

This process will create a scan for each selected dataset. You can cancel the scan or review the execution logs in the **Scans** tab on the dataset, as well as on the general **Scans** page.

{% columns %}
{% column width="50%" %} <i class="fa-check">:check:</i> **Successful scan**

* **The generated contract is published.**
  * A **purple checkmark** icon indicates that it is an automatically generated contract.
  * The icon will change to a **blue checkmark** icon after there is a **user edit**, to indicate it is a user-generated contract.
* **A** [**data contract history**](https://docs.soda.io/cloud-managed-data-contracts/author-a-contract-in-soda-cloud#contract-history) **entry is published**, indicating that Autopilot published a first version of the contract.
* \[If configured] A "published contract" Webhook will be published (for example, to allow sync to Git).
  {% endcolumn %}

{% column width="50%" %} <i class="fa-x">:x:</i> **Failed scan**

* The dataset is marked with the message "**Contract generation has failed**".
* **Scan logs** can be reviewed to understand the underlying cause.
* The contract generation can be **re-triggered** after inspecting the root cause.
  {% endcolumn %}
  {% endcolumns %}

***

## Requirements & limitations

{% hint style="info" %}
Autopilot is **only available upon request**. [Contact us](mailto:support@soda.io) to enable it in your organization.
{% endhint %}

**Contract Generation Scope**

Autopilot can only generate data contracts for datasets that do **not** already have an existing data contract. Datasets with an existing contract are not eligible for contract generation via Autopilot.

**Autopilot is currently a Soda Cloud feature:**

* A **Soda Agent** is required
* CLI or Python API are not available
* APIs are not available

**Data types**

Autopilot works on the following data types:

* text
* numeric
* timestamps

Columns with other data types, such as JSON or structured array, for example, are not currently supported.

**Data sources**

Autopilot is supported on:

* Snowflake
* Databricks
* Postgres
* Athena
* Țrino
* Dremio
* Oracle
* SQLServer
* Synapse
* Fabric
* Redshift

{% hint style="success" %}
**Contract Autopilot is assistive** and does not autonomously modify data or execute destructive operations. Users can review generated contracts before execution.
{% endhint %}

***

## Privacy & security

Contract Autopilot is designed to minimize data exposure while generating meaningful contract recommendations.

The following data is used locally by Soda:

* A sample of approximately **10,000 rows** to compute profiling metrics

The following data is sent to Soda’s managed OpenAI API:

* Computed profiling metrics
* Data source type
* Dataset schema
* A sample of up to 100 rows, if enabled in the [organization settings](https://docs.soda.io/organization-and-admin-settings/general-settings#send-row-level-data-to-soda).

{% hint style="info" %}
Access to Contract Autopilot is **restricted to users with appropriate** dataset **permissions**.
{% endhint %}

> Learn more about [Soda's AI security & privacy measures](https://docs.soda.io/reference/soda-ai#sodas-ai-security-and-privacy-measures).

***

## Next steps

Manage the [organization settings](https://docs.soda.io/organization-and-admin-settings/general-settings#enable-contract-autopilot-powered-by-openai) to:

* enable/disable Contract Autopilot
* allow Soda to send a small sample of row data to OpenAI

After contract generation, you can:

* Review generated checks
* Validate assumptions with domain experts
* Adjust schedules and thresholds
* Iterate using [Contract Copilot](https://docs.soda.io/data-testing/contract-copilot)

<br>

***

{% if (visitor.claims.plan === 'datasetStandard')%}
{% hint style="success" %}
You are **logged in to Soda** and seeing the **Free license** documentation. Learn more about [documentation-access-and-licensing](https://docs.soda.io/reference/documentation-access-and-licensing "mention").
{% endhint %}
{% endif %}

{% if (visitor.claims.plan === 'enterprise')%}
{% hint style="success" %}
You are **logged in to Soda** and seeing the **Team license** documentation. Learn more about [documentation-access-and-licensing](https://docs.soda.io/reference/documentation-access-and-licensing "mention").
{% endhint %}
{% endif %}

{% if (visitor.claims.plan === 'enterpriseUserBased')%}
{% hint style="success" %}
You are **logged in to Soda** and seeing the **Enterprise license** documentation. Learn more about [documentation-access-and-licensing](https://docs.soda.io/reference/documentation-access-and-licensing "mention").
{% endhint %}
{% endif %}

{% if !(visitor.claims.plan === 'enterprise' || visitor.claims.plan === 'enterpriseUserBased' || visitor.claims.plan === 'datasetStandard')%}
{% hint style="info" %}
You are **not logged in to Soda** and are viewing the default public documentation. Learn more about [documentation-access-and-licensing](https://docs.soda.io/reference/documentation-access-and-licensing "mention").
{% endhint %}
{% endif %}


---

# Agent Instructions: 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 current page URL with the `ask` query parameter:

```
GET https://docs.soda.io/data-testing/contract-autopilot.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
