Skip to content
DataTug.ai
GitHub

ETL with an AI agent

Build your ETL with your AI agent, on an open standard, with free tools.

An agent can write a data pipeline. The hard part is knowing whether to trust it. OpenFlange keeps each step small enough to read, publishes its rules in a form agents can read too, and ships a command that validates and tests what the agent wrote, on your machine.

See the exampleRead the specification for agents

Why an agent can do this well

None of it depends on a particular model or a particular agent.

  • The contract is one small file

    Every pipe has an OPENFLANGE.md: its inputs, outputs, parameters and permissions in a few dozen lines of YAML, then plain notes. An agent can write it, and you can read it in a minute.

  • The rules are written for agents too

    The specification is published as plain text: openflange.org/llms.txt indexes it, and each page has a Markdown version. Your agent reads the rules instead of guessing them.

  • A command checks the work

    openflange validate reports every problem in one pass, with the file, the line and a suggestion. openflange test runs the tests that sit next to the pipe. The agent fixes what they find until both pass.

  • Free, and it runs on your machine

    The tool is open source under Apache-2.0: openflange/openflange-go. No account, no service, no data leaving your laptop.

A scoped example: prompt, files, checks

One step of a real job: customer emails arrive with stray spaces and mixed case. Ask for one pipe, one test and one pipeline, and ask the agent to prove them.

  1. Step 1

    The prompt

    Small, with the rules attached and the checks named.

    prompt
    Read https://openflange.org/llms.txt first.
    
    In ./etl, write an OpenFlange pipe "clean-email" that trims and lower-cases an e-mail address, with a test next to it. Then write a pipeline "customer-emails" that runs it on its "email" input.
    
    Run "openflange validate" and "openflange test" and fix what they report until both pass. Show me their output.
  2. Step 2

    The files the agent writes

    Three files. The first is the contract: read it before anything else.

    etl/pipes/clean-email/OPENFLANGE.md
    ---
    spec: openflange.org/pipe/v0.1
    id: clean-email
    version: 0.1.0
    title: Clean email
    description: Trims and lower-cases e-mail addresses.
    scope: record
    cardinality: one-to-one
    deterministic: true
    inputs:
      email:
        description: E-mail addresses, one JSON string per line.
        schema:
          format: json-schema
          definition: {type: string}
    outputs:
      email:
        description: The same addresses, trimmed and in lower case.
        schema:
          format: json-schema
          definition: {type: string}
    implementation:
      type: expression
      language: starlark
      expression: email.strip().lower()
    ---
    
    Implements the [OpenFlange](https://openflange.org/) specification.
  3. Step 2, continued

    The test beside the pipe

    etl/pipes/clean-email/tests/clean-email.test.yaml
    spec: openflange.org/test/v0.1
    pipe: ..
    tests:
      - name: trims and lower-cases
        inputs:
          email: {values: [" Ada@Example.COM "]}
        expect:
          outputs:
            email: {values: ["ada@example.com"]}
  4. Step 2, continued

    The pipeline that uses it

    etl/customer-emails/pipeline.yaml
    spec: openflange.org/pipeline/v0.1
    nodes:
      clean:
        pipe: ../pipes/clean-email
        inputs:
          email:
            from: inputs.email
    outputs:
      email:
        from: clean.outputs.email
  5. Step 3

    The commands that verify them

    Run them yourself. Do not take the agent’s word for it.

    terminal
    $ openflange validate ./etl/customer-emails/pipeline.yaml
    valid: ./etl/customer-emails/pipeline.yaml (1 node, 2 edges)
    
    $ openflange test ./etl
    etl/pipes/clean-email/tests/clean-email.test.yaml
      ok    trims and lower-cases
    ok 1 test passed in 1 file (4ms)
    
    $ printf '" Ada@Example.COM "\n' | \
        openflange run ./etl/customer-emails/pipeline.yaml
    "ada@example.com"
    completed in 161µs — email: 1 record

The files and the commands above were run as printed against openflange 0.0.2, installed with go install, on 4 December 2026, and a test of this site runs them again on every change; only the timings differ from run to run. They show what one agent run can look like; your agent’s files will differ, and the checks stay the same.

From one pipe to the whole job

The same way of working scales to a real pipeline: customers from PostgreSQL, orders from a CSV export, one result.

An ETL pipeline as a flow: extract, transform, loadTwo sources are extracted: customers from PostgreSQL and orders from a CSV export. Customers go through a Starlark pipe that cleans emails. A SQL pipe joins the cleaned customers with the orders, and a second SQL pipe totals revenue per customer. The result is loaded as the dataset customer-revenue in DuckDB.ExtractYour databases as sourcesTransformPipes in any languageLoadMaterialise as a datasetcustomersPostgreSQLorders.csvCSVClean emailsStarlarkJoin with ordersSQLRevenue per customerSQLcustomer-revenueDuckDBAn ETL pipeline as a flow: extract, transform, loadTwo sources are extracted: customers from PostgreSQL and orders from a CSV export. Customers go through a Starlark pipe that cleans emails. A SQL pipe joins the cleaned customers with the orders, and a second SQL pipe totals revenue per customer. The result is loaded as the dataset customer-revenue in DuckDB.ExtractYour databases as sourcesTransformPipes in any languageLoadMaterialise as a datasetcustomersPostgreSQLorders.csvCSVClean emailsStarlarkJoin with ordersSQLRevenue per customerSQLcustomer-revenueDuckDB
Design sketch The whole job as a pipeline. A drawing, not a run: your agent can write and test the transform steps with the openflange tool, and the DataTug CLI adds the database source and the dataset.
  1. Extract

    Your databases as sources

    Reading a file is a standard pipe. Reading a database through DataTug’s connections and access policies is a DataTug step, builtin:datatug/query, in the DataTug CLI since v0.162.0.

  2. Transform

    Pipes in any language

    This is where an agent earns its keep: small steps in SQL, R, Python or Starlark, each with a contract and a test.

  3. Load

    Materialise as a dataset

    DataTug keeps the result as a named dataset in DuckDB, with a record of where it came from: the builtin:datatug/dataset step, also in the DataTug CLI since v0.162.0.

Get the tool

An experimental pre-release, v0.0.2. With Go installed, one command installs it (into Go’s bin directory, which should be on your PATH), or you can build it from source.

  1. Install

    The openflange command

    terminal
    go install github.com/openflange/openflange-go/cmd/openflange@v0.0.2
  2. Or build from source

    The same version, from its tag

    terminal
    git clone --branch v0.0.2 https://github.com/openflange/openflange-go
    cd openflange-go
    go build -o openflange ./cmd/openflange

Where DataTug comes in

  • The agent plugin, as it is today

    Available

    The datatug plugin installs from the DataTug marketplace into Claude Code and Codex. Its skills cover connecting, exploring and querying with the DataTug CLI. See the skills. None of them builds pipelines yet.

  • Your databases as sources

    Available

    The DataTug CLI runs OpenFlange pipelines with a saved query, TugQL or SQL as a source, under the same access policies as any other query: released in v0.162.0. A visual designer for them is in development.

  • Access the agent does not hold

    Available

    A source step reads through DataTug’s policy path, so the agent that wrote the pipeline does not need a database password to have it run.

What to keep in mind

  • Experimental means experimental

    The tool is an experimental pre-release, v0.0.2, of draft v0.1 specifications. Formats and commands can still change between versions: pin the version you install.

  • Permissions are consent, not a sandbox

    A pipe that runs a program asks for a grant, such as --grant subprocess. Granting it does not confine the program. Read what the agent wrote before you grant anything.

  • Not a scheduler, not a warehouse

    Nothing here runs on a timer or stores your data for reporting. A pipeline runs when you start it.

Give your agent the rules, then check its work

Start with one pipe and one test. The rest of the pipeline is the same move, repeated.

Open the specification for agentsThe tool on GitHub