Skip to main content
  • Each pipeline should have a unique alias and should be defined in the different files.
  • A pipeline should have at least one transform function.
  • You can define dependencies between pipelines using the depends or input_mapping parameter to create a directed acyclic graph (DAG).

Complex Pipeline Example

Data Flow Management

The @transform decorator enables you to define data transformation functions efficiently. Each function should:
  • Accept input data as arguments
  • Process the data
  • Return the transformed data
Data is handled as PySpark DataFrames both for input and output operations.
In above example,
  1. clean_data function takes input_data as input. You can check the dataset alias in the Datazone UI or use the datazone dataset list command to list all datasets.
  2. After cleaning the data, the clean_data function returns the cleaned data PySpark DataFrame as lazy evaluation.
  3. The aggregate_data function takes the cleaned data as input and aggregates it and returns the aggregated data.
  4. Since the materialized parameter is set to True, the aggregate_data function will be materialized and create a new dataset in Datazone.
Check the Transform section for more information on how to define a transform decorator.

Invoking LLM Models

Transforms can call an LLM through one of your Model Accounts with the Agent class — no provider SDK or API key in your pipeline code. The call is proxied by Datazone and its token usage is attributed to the pipeline.
class
Create an agent bound to a model account and model.Parameters:
  • model (optional) — model to use, e.g. CLAUDE_45_SONNET. Defaults to your organisation’s default model.
  • model_account (optional) — model account id. Defaults to your organisation’s AI settings account.
  • response_format (optional) — a Pydantic model or JSON schema dict for structured output.
method
Invoke the model and return a result dictionary.Accepts either a plain string or a message list:
Message roles are system, user and assistant. Returns a dict with:
  • content — the raw text answer (empty when response_format is used)
  • structured_response — the parsed object when response_format is used, otherwise None
  • model — the model that produced the answer
Raises RuntimeError if the invocation fails.

Structured Output

Pass a Pydantic model as response_format to get a validated object back instead of raw text:
Each invoke is one request, so a row-by-row loop over a large dataset is slow and costly. Filter the input first, or batch several records into a single prompt and ask for a list back.

Asking a Decision Model

For classification, routing and scoring, ask a decision model with agent.decide. It answers typed questions with probabilities instead of text, so there is nothing to parse, and it is fast enough to call once per row.
method
Ask a decision model typed questions about a state.Parameters:
  • state — what the questions are about: a string, a JSON object, or a list.
  • questions — a dict of question name → question with type (noul, choice or score), instructions and criteria — see Question Types.
The agent’s model is required and must be an enabled model of kind Decision on the model account.Returns a dict with answers (keyed by question name) and model. Raises RuntimeError if the call fails.
This transform triages a list of support tickets and writes one row per ticket:
The resulting decision_triaged_tickets dataset:
To triage a dataset instead of a fixed list, take it as an input and loop over its rows. Pass each row as a JSON object — agent.decide(state=json.loads(row.to_json()), questions=QUESTIONS) — so the model sees each column by name. to_json also turns timestamps and numpy numbers into plain JSON values.

Transform Selection

When executing a pipeline, you can selectively run specific transforms using the transform_selection parameter in the “Run with Config” modal. This allows you to execute only the transforms you need, along with their dependencies if required.

Selection Patterns

Use transform selection to optimize execution time by running only the necessary parts of your pipeline during development and testing.

Usage Examples

For the pipeline example above with prepare, build_project, build_report, and notify_email:
  • build_project - Runs only the build_project transform
  • *build_project - Runs prepare and build_project (transform with all ancestors)
  • prepare* - Runs prepare, build_project, and build_report (transform with all descendants)
  • *notify_email* - Runs the entire pipeline (transform with all ancestors and descendants)