UDF Agent

image-20260817-081702.png

The UDF Agent creates a Custom Python Transformation (UDF) from sample files. Upload an example of your source data and an example of the result you want. The agent writes the Python for you, so you do not need to build the transformation by hand.

At a glance
The UDF Agent generates Python 3.11 from CSV input and output samples, shows a summary of what the code does, lets you test the transformation on your sample, and adds the approved UDF to the Data Flow. You can then refine the UDF in chat without uploading a new input file.

Only one UDF is allowed per Data Flow (UDF Agent or write-your-own Python, not both). Prebuilt Action Nodes are not limited this way. See Data Flows.

image-20260817-082253.png

Contact Support if the UDF Agent is not available in your account.


When to use the UDF Agent

Use the UDF Agent when a prebuilt Action Node is not enough, and you would rather describe the transformation with examples than write Python yourself.

Use Custom Python Transformation (UDF) instead when you already have Python to paste in, or when you want to write the logic yourself.

UDF runtime is limited to 15 minutes (test and live Data Flow runs).


Create a UDF with the agent

1. Navigate to Data > Data Flows and click on New data flow.

image-20260817-081856.png

2. Add a Source. Then, click + Add Transformation to open the transformations library.

3. Under Create A Transformation, select Use the UDF Agent.

2026-08-17_13-52-39 (1)-20260817-082425.gif

The UDF Agent opens in a full-page editor. Prebuilt Action Nodes use a drawer on the canvas instead.

Upload sample files

The agent needs two CSV files:

  • Input sample — how the data looks before the transformation.

  • Output sample — how the same records should look after the transformation.

Drag each file onto the upload area, or click to browse.

2026-08-17_14-04-58 (1)-20260817-084027.gif

The UDF Agent currently accepts CSV samples only. If the file type is not supported, the agent asks you to upload a new file before you continue. If you need a different output format later, add an Output File Format Action Node after the UDF.

If a sample cannot produce the other file — for example, the output contains values that cannot be derived from the input — the agent explains what is wrong. Fix or replace the sample, then continue. The agent does not change your sample data unless you explicitly approve a change to the UDF.


Review the generated code

When both files upload successfully, the agent starts generating Python. Confirm the generated version when prompted. A summary of the code appears in the upper right, in the same order as the script. The Python itself is shown below the summary.

Technical users can still read and edit the code. Non-technical users can rely on the summary and the test step.

Validate my UDF code (chat prompt)

Sends that prompt to the agent. The agent reads the current draft Python and runs a static check (validate_udf) — it does not transform the sample file.

2026-08-17_14-11-18 (1)-20260817-084133.gif

It looks for things like:

  • code that won’t compile

  • mixed row vs DataFrame style (input_row / output_row vs input_df / output_df)

  • missing output variable

  • unsafe imports/ops (os, subprocess, open, etc.)

Results show up in chat. Code is not changed unless you later accept a suggested fix.

Suggest improvements (chat prompt)

The agent reviews the current draft for quality — style, logic, reliability — and lists recommended changes. You can then Apply these improvements.

2026-08-17_14-14-42 (2)-20260817-085449.gif

Apply writes the new code into the draft. It still does not run the UDF on the file. That’s why the agent then says to use Test Output to verify.

Run Test Output (top-right editor button)

This is the actual test run, not chat. It executes the current UDF against Data Input and writes the result into Data Output (or an error).

2026-08-17_14-22-41 (1)-20260817-085252.gif

The test view opens full screen with the input sample you already uploaded. You can remove that file and upload a different sample to try another case.

Run Test Output executes the current UDF against Data Input. If that run (or a later live Data Flow run) takes longer than 15 minutes, the job fails. This limit is the same for the UDF Agent and write-your-own Python.


Add the UDF to the Data Flow

When the transformation looks correct, click Add to Data Flow. That approves the code and places the UDF on the canvas.

After you save, name the UDF and set failure handling (for example, continue on failure or fail the step if too many rows error). Later, open those settings from the menu on the canvas card.

A Data Flow can include one UDF node: either the UDF Agent or Write Your Own Code. After one is added, the other option is hidden or disabled in the Transformations Library. Remove the UDF from the canvas to choose a different type. This limit does not apply to Output File Format.

Edit an existing UDF Agent

Click the UDF card on the canvas, or use > Edit / Edit Code.

You return to the UDF Agent with the code summary and the Python at the bottom.

  • Use chat to request changes without uploading a new output file. Quick-start prompts are available, or type in natural language.

  • Upload a new output sample if you want the agent to regenerate from a different target shape.

  • To change the input sample, create a new Data Flow. The agent does not replace the original input on an existing UDF.

2026-08-18_11-53-21 (1)-20260818-062356.gif

Errors and troubleshooting

If the agent fails to load, an error message explains the problem. Stay on the page and retry, or contact Support if it persists.

During testing:

  • Row-level errors (value, type, and similar): the agent highlights the issue in chat and can suggest a UDF change. The data output includes a status column on problem rows.

  • Blocking schema errors (wrong or missing columns): the agent explains the problem and may suggest a UDF change or a fix to your file. The data output area shows an error instead of a table.

No change is applied to the UDF until you approve it. The agent does not auto-correct rows in the sample file.

Symptom

Likely cause

What to do

Upload rejected / wrong file type

Sample is not CSV, or the type cannot be read

Upload a CSV. Convert JSONL or other formats before using the agent, or use Write Your Own Code.

Agent cannot generate a UDF

Output cannot be derived from the input

Fix or replace the sample the agent called out, then generate again.

Row errors in Test with your data

A value or type in the sample does not match the UDF

Review the status column and chat. Approve a UDF change only if you want the logic updated.

No output table after test

Schema mismatch (columns)

Follow the agent’s file or UDF suggestion, then test again.

Cannot add a second UDF

One UDF already exists on the flow

Remove the existing UDF, or keep it and use prebuilt nodes instead.

Best practices
  • Keep samples small and representative. Include the columns and edge cases the live file will have.

  • Make the output sample the true target shape, not a partial sketch.

  • Always run Test with your data before Add to Data Flow.

  • Prefer chat for small tweaks. Upload a new output sample when the target structure has changed.

  • If you need a file type other than CSV after the UDF, add Output File Format downstream.