> ## Documentation Index
> Fetch the complete documentation index at: https://deepline.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate from Clay | Agent guide

> Export a Clay workflow, map its logic to Deepline Plays, and compare behavior and cost before cutover.

[Human guide: task steps and agent prompt →](https://deepline.com/docs/human/migrate-from-clay.md)

```text theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
/clay-to-deepline Plan a migration from this Clay workflow to Deepline. Show the mapping, unsupported behavior, and a same-record comparison before building or running it.
```

The dedicated `clay-to-deepline` skill handles extraction, mapping, Play
generation and comparison. Start with one workflow and keep Clay active while
you prove the replacement.
Provide its configuration, sample records with stored Clay results, expected
outputs and rules for external writes. Use [Installation](https://deepline.com/docs/use-with-an-agent.md)
if Deepline is not set up. Keep credentials and sensitive exports out of source
control and credentials out of chat.

## Choose the migration shape

| Clay source | Deepline target |
| - | - |
| Batch table | CSV-input Play preserving source rows and column dependencies |
| Reusable function | Play with the function's typed inputs and returned outputs |
| Webhook, schedule or routing workflow | Play plus explicit triggers and destination actions |

A function's internal `write-to-cell` output becomes the Play's return value;
its caller parameters are not a lead CSV. For enrichment followed by CRM or
campaign writes, prove enrichment first, then add the reviewed destination step.

## Export the configuration and comparison data

Already have a configuration export? Use it directly. A row-only CSV supplies
comparison data but cannot establish the formulas, prompts or action settings.

If you use the [Clay CLI](https://github.com/clay-run/agent-plugins), ask your
agent to confirm the Clay workspace and use the migration recipe's export path
for the selected configuration, functions and sample rows. Request read-only
extraction; exporting does not require running or changing the Clay workflow.
Without CLI access, use the bookmarklet below.

## Export the table with the Clay Extract bookmarklet

> [accordion] Use the Clay Extract bookmarklet
>
> **1. Add the bookmarklet**
>
> Drag **Clay Extract** to your bookmarks bar. If dragging is unavailable,
> select it to copy its URL, then create a bookmark with that address.
>
> **2. Open Clay and extract**
>
> Open the signed-in table view or workbook, then select the saved bookmark. A
> progress message appears and the browser downloads `clay_extract_*.json`. A
> workbook export contains its child tables.
>
> **3. Check and attach the export**
>
> Attach the JSON to your agent. Check `_meta.truncated`, fetched record
> counts and workbook `failures`: a downloaded export can still be partial.
>
> The bookmarklet reads configuration, fields, schema, samples and up to 500 full
> records per table through your existing Clay session. It downloads the export
> locally without changing Clay or reading, saving or sending your cookie to
> Deepline. Missing or failed records are not evidence of equivalent behavior.

## Review the mapping before building

Ask the agent for a column-by-column map of inputs, formulas, provider actions,
AI prompts, run conditions, fallbacks, outputs and external writes in dependency
order. Mark recovered versus approximated prompts and resolve assumptions.
Record unsupported actions and connected-table dependencies that need manual
implementation or must stay in Clay.

Map provider connections to available Deepline access. Owners or admins connect
required accounts through [Integrations](https://deepline.com/docs/integrations.md). An export alone does
not establish that replacement providers are available in that org.

After accepting the map, have the agent build `clay-migration.play.ts` with a
name, top-level description, source identity, accepted outputs and explicit
exceptions. A batch Play can accept `{ "csv": "leads.csv" }`; a function uses its
reviewed parameters and return contract. Keep external writes disabled in the
first pilot.

## Check formulas and source

Compare deterministic formulas and lookups with stored Clay cells before paid
work. The CLI migration helper's parity report distinguishes exact matches from
stale, unevaluated, missing-sample and error cases. Resolve mismatches and report
excluded cases separately; they do not count as matches. Bookmarklet exports
can lack structured action fields, leaving formulas that read them unvalidated.

Use [Build a Play](https://deepline.com/docs/sdk-v2/plays.md) to check the source. This needs Deepline
authentication and network access, but does not publish, run or call providers.
Formula parity does not establish provider or AI result parity.

## Compare a representative pilot

Choose normal, sparse and edge-case records with original identities and Clay
results. Define accepted output, protected values and explicit exceptions, such
as `not_found`, `catch_all` and `needs_review`.

For a batch Play, use [CSV-safe selection](https://deepline.com/docs/sdk-v2/batch-csv.md#2-select-representative-csv-records)
to prepare `leads-pilot.csv`, then [run the Play and export its dataset](https://deepline.com/docs/sdk-v2/calling-plays.md)
with `{ "csv": "leads-pilot.csv" }`. For functions and event-driven Plays, use
the reviewed input contract. Retain the run ID. Provider-backed pilots can use
Deepline credits.

Compare outputs, unresolved rows, fallback behavior and write boundaries on the
same cases. Separate mapping errors from changed source data and nondeterministic
AI output; an old Clay lookup is not a current-data baseline. Record intentional
differences and preserve existing valid values.

> [!TIP]
>
> Compare cost on the same sample and acceptance rule: record Clay and Deepline
> usage separately, include applicable BYOK charges, and calculate cost per
> accepted result. Label catalog prices as estimates and unpriced columns as
> unknown. Raw credit counts are not equivalent currencies, and projected
> savings are not measured full-run savings.
>
> Exclude completed pilot row IDs from the remaining input unless a rerun is
> intended. Starting a new run does not guarantee reuse of paid work.

## Publish and cut over

Keep Clay as the fallback until the comparison passes. Publish the reviewed
source and inspect the named Play's live revision:

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline plays publish ./clay-migration.play.ts
deepline describe clay-migration
```

Add [triggers](https://deepline.com/docs/sdk-v2/webhooks-and-schedules.md) and approved destination writes
after the Play is correct. Assign one active trigger and destination writer at
cutover so both systems cannot apply the same change. Retain the Clay
configuration and rollback plan until operating checks pass. Use
[Cost control](https://deepline.com/docs/cost-control.md) for ongoing usage limits.

## Verify this task

Reconcile the same input records, action settings, accepted outputs and
exceptions before declaring equivalence. Confirm that only the intended system
owns recurring work and destination writes after cutover.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.