Set up a pipeline project
Create a sample Python pipeline in your own repository, connect it to a pipeline project and run it in Vegalake.
This guide builds a small working project from an empty repository: one Python pipeline with two activities, deployed to a development environment and run from Vegalake. When it works, replace the sample code with your own.
A pipeline project reads its code from a Git repository. Every commit on the branch an environment tracks is synced: Vegalake reads the code, finds the pipelines in it and deploys them to that environment. Nothing runs until you start a run or add a schedule.
Before you start
You need:
- A Git integration for the provider that hosts your repository.
- A running VegaFlow cluster, and permission to use it. Python pipelines run on a dedicated cluster, not on serverless compute.
- An active service principal for the pipelines to run as, and permission to act as it. Create one under Access management if your organization has none. Read Users, roles and service principals.
- Permission to create pipeline projects in the workspace.
Step 1: Add the sample code to your repository
Create a repository in your Git provider, or use an existing one, and add this file at pipelines/daily_orders.py:
from vegaflow import TaskContext, activity, pipeline
@activity(retries=3)
def load_orders(ctx: TaskContext, day: str) -> list[dict]:
# Replace with a read from your source system.
return [
{"order_id": 1, "day": day, "amount": 120.00, "status": "paid"},
{"order_id": 2, "day": day, "amount": 45.50, "status": "refunded"},
{"order_id": 3, "day": day, "amount": 80.25, "status": "paid"},
]
@activity
def summarize(ctx: TaskContext, orders: list[dict]) -> dict:
paid = [order for order in orders if order["status"] == "paid"]
return {
"orders": len(orders),
"paid_orders": len(paid),
"revenue": round(sum(order["amount"] for order in paid), 2),
}
@pipeline(name="daily_orders")
def daily_orders(params: dict | None = None) -> dict:
day = (params or {}).get("day", "2026-01-01")
orders = load_orders(day)
return summarize(orders)Commit and push it to the default branch, for example main. The repository layout is:
your-repository/
└── pipelines/
└── daily_orders.pyWhat the code declares:
@pipelinemarks the entry point that Vegalake lists and runs. Itsnameis the name you see in Vegalake.@activitymarks a step. Each activity call is recorded, so a failed run can retry a step without repeating the ones that already finished.load_ordersretries up to three times.- The pipeline takes one optional input, a JSON object. Because the input is optional, the pipeline can run without one.
Step 2: Create the project
Open pipeline projects
In the Build space, open Pipeline projects under Code, then select New project.
Name the project
Enter a Project name, such as Sample orders, and select Create and configure. Vegalake opens the project's Configure page on Project & repository, which walks through the next steps in order.
Step 3: Connect the repository
Repository
Choose the Git integration, enter the Repository (for example acme/sample-orders on GitHub) and the Default branch, then select Connect repository. For other providers' repository formats, and the Azure DevOps repository ID, read Connect the repository to a pipeline project.
Definitions roots
Enter pipelines and select Add root. Vegalake only scans these folders for pipelines.
Environment
Keep the Environment name Development and the Tracked branch set to your default branch. For Compute, choose your cluster. For Run as, choose the service principal. Then select Create Environment.
This environment deploys each new valid commit automatically. To approve each deployment first, create the environment from Configure → Environments & previews → New Environment with the Require approval activation policy, then use the environment's Set up runtime button to choose its compute and Run as.
Step 4: Sync the first commit
In the Build project step, select Run first discovery. Vegalake reads the latest commit on the tracked branch, checks the code and finds its pipelines. It does not run them.
When the sync finishes, the project's Pipelines tab lists daily_orders. If the sync reports problems, read Troubleshooting.
From now on, every push to the tracked branch is synced: as soon as it's pushed if the Git integration has a webhook, otherwise within a few minutes. To sync straight away, select Sync now on the project's Settings tab.
Step 5: Run the pipeline
Start a run
On the project's Pipelines tab, select Run next to daily_orders, then Run to confirm.
Follow the run
Open the run from the Runs tab. Each step has Log, Inputs and Attempts tabs. The run returns:
{ "orders": 3, "paid_orders": 2, "revenue": 200.25 }To pass an input, such as {"day": "2026-11-24"}, open the pipeline in the code editor, select Run daily_orders… under Schedules and triggers, enter the Input JSON and select Start execution.
To start a run through the API, send the environment ID. With no version_id, the run uses the version in the environment's active deployment:
POST {api-base}/orgs/{org_id}/workspaces/{workspace_id}/pipelines/{pipeline_id}/executions
Idempotency-Key: 3f1c2a6e-1d1b-4c55-9a43-0f3b8d2e7a10
Content-Type: application/json
{
"environment_id": "<environment id>",
"input": { "day": "2026-11-24" }
}Step 6: Add a schedule (optional)
Schedules live in the code next to the pipeline. Add this to the end of pipelines/daily_orders.py, and add schedule to the from vegaflow import line:
schedule(
name="every morning",
pipeline=daily_orders,
expression="0 6 * * *",
timezone="UTC",
overlap_policy="SKIP",
)Push the change. Once the commit is synced and deployed, the schedule is active in that environment and starts the pipeline at 06:00 UTC every day. overlap_policy="SKIP" skips a start while the previous run is still going. Read Schedules and triggers for pausing schedules and the other policies.
Writing your own pipelines
- Where Vegalake looks: every
.pyfile under a definitions root is imported. Files directly under the root import as top-level modules, sopipelines/daily_orders.pyis the moduledaily_orders. Do not name a file after a standard library or installed module, such asjson.pyorpandas.py. Folders starting with.are skipped. - Keep imports quick and quiet: importing a file must only declare things. Do not read data, call services or print at import time. Output written during import is reported as a warning.
- Put work in activities: reading and writing data, calling APIs and anything slow or random belongs in an
@activity. The@pipelinefunction only calls activities and combines their results, so a run can resume where it stopped. - Declare functions at the top level: pipelines and activities cannot be lambdas or nested functions, and cannot take
*argsor**kwargs. - Python packages: code runs on Python 3.13 with a fixed set of packages that includes pandas, polars, pyarrow, DuckDB, NumPy, scikit-learn and openpyxl. Vegalake does not install packages listed in your repository, such as a
requirements.txtorpyproject.tomlfile. - Credentials: never commit passwords or tokens. Use connections and Secret vaults, and give the environment's service principal access to them.
- Settings for each environment: put non-secret settings, such as a warehouse name, in the environment's configuration (Edit configuration on the environment) instead of in the code.
Troubleshooting
| Problem | What to check |
|---|---|
| The configured Definitions roots contain no decorated Pipelines | No file under the roots has a @pipeline function. Check the root folder name and that the file is committed on the tracked branch. |
| Definitions root does not exist in the source artifact | The folder is missing on the tracked branch, or the root path has a typo. Roots are relative to the repository root, without a leading /. |
| A module failed to import | The file raised an error when imported, often a missing package or a typo. The problem lists the file and line. |
| Repository module conflicts with a fixed runtime module | Rename the file so it does not share a name with a standard library or installed module. |
| The environment needs compute and a service principal | Use Set up runtime on the environment to choose a cluster and Run as. Deployments cannot activate without them. |
| The sync or run does not start | The environment's cluster must be running. Start it from VegaFlow → Clusters. |
| A deployment is waiting for approval | The environment uses Require approval. Approve it on the project's Releases tab. |
| The repository or branch cannot be read | Read Connect a Git repository. |
Next steps
- Pipeline projects: repository settings, source revisions and versions.
- Git and deployments: environments, approvals and promotion.
- Runs and observability: retries, failures and logs.