Transformation class is the SDK surface for VectorShift’s stored Python functions. Define a function once — its source, typed inputs, and typed outputs live on the platform — then run it directly from Python, or drop it into a Pipeline as a TransformationNode.
Prerequisites: Installed SDK · API key set · Python 3.10+.
Mental model
- A transformation is a named Python function plus a typed I/O schema. The function source is stored as a string;
inputs/outputsmap each name to anIOType(optionally wrapped inIOConfigfor a description). - Two ways to create one:
- Imperative —
Transformation.new(name, function=…, inputs=…, outputs=…), passing the source as a string. - Decorator —
@Transformation.from_functionover a real Python function. The SDK reads the source, infers the schema from type hints, and upserts it by name (idempotent: fetch-by-name → update-if-changed → create).
- Imperative —
- Run it with
t.run(inputs={…}), which blocks on the engine and returns a typedTransformationRunResultwith.status,.outputs, and an optional.error. - Or compose it into a Pipeline via
TransformationNode(transformation=t.id, …), wiring each declared input to an upstream node output. - Every method has an async sibling (
anew,afetch,arun,aupdate, …).
Quick start
From a Python function
The@Transformation.from_function decorator is the ergonomic path — write a normal function, let the SDK infer the schema and upload the source:
TypedDict, a literal return {…} dict, or a single result). The decorator is idempotent under name, so re-running your script updates the stored function only when the source or schema changed. See the from-function example.
Ways to use a transformation
| Run directly | Inside a Pipeline | |
|---|---|---|
| Surface | t.run(inputs={…}) | TransformationNode(transformation=t.id, **wired_inputs) |
| Output | TransformationRunResult — .status, .outputs | A node output you wire into downstream nodes |
| Use when | Calling the function ad-hoc or from your own code | The function is one deterministic step in a graph |
| Guide | This page’s Quick start | pipeline-node example |
What’s next
Reference
Every public method, type, and enum.
CRUD example
The full create / fetch / list / update / delete lifecycle.
From a function
Decorate a Python function and let the SDK infer the schema.
