A multi-step pipeline that chains Tasks using dependsOn and passes results
between stages. One agent scaffolds a feature, a second writes tests on the
same branch, and a third opens a PR.
Break complex work into specialized steps. Each agent focuses on one job and hands off structured results (branch name, commit SHA) to the next stage. The controller ensures ordering, detects cycles, and fails fast if an upstream stage fails.
| File | Kind | Purpose |
|---|---|---|
credentials-secret.yaml |
Secret | Claude OAuth token for the agent |
github-token-secret.yaml |
Secret | GitHub token for cloning and PR creation |
workspace.yaml |
Workspace | Git repository to clone |
pipeline.yaml |
Task (x3) | Three chained Tasks forming a pipeline |
scaffold (Task)
│ creates branch, writes code
│ outputs: branch, commit
│
▼
write-tests (Task, dependsOn: [scaffold])
│ checks out the same branch
│ reads scaffold's branch via {{.Deps.scaffold.Results.branch}}
│ outputs: branch, commit
│
▼
open-pr (Task, dependsOn: [write-tests])
│ reads branch from write-tests results
│ opens a pull request
│ outputs: pr URL
-
dependsOn— a Task lists the names of Tasks that must succeed before it starts. The controller moves the Task toWaitingphase until all dependencies reachSucceeded. If any dependency fails, the downstream Task fails immediately. -
Result passing — when a Task completes, the controller captures structured key-value outputs (branch, commit, PR URL, etc.) into
status.results. Downstream Tasks can reference these in their prompt using Go template syntax:{{index .Deps "scaffold" "Results" "branch"}}The
.Depsmap is keyed by dependency Task name and containsResults(the key-value map) andOutputs(raw output lines). -
Branch serialization — Tasks sharing the same
branchvalue are serialized automatically. Only one runs at a time, so the second Task always sees the first Task's commits. -
Cycle detection — the controller detects circular dependencies via DFS and fails the Task immediately.
-
Edit the secrets — replace placeholders in
credentials-secret.yamlandgithub-token-secret.yaml. -
Edit
workspace.yaml— set your repository URL. -
Apply the resources:
kubectl apply -f examples/07-task-pipeline/- Watch the pipeline progress:
kubectl get tasks -wYou should see scaffold run first, then write-tests move from Waiting
to Running, and finally open-pr.
- View results from a completed Task:
kelos get task scaffold -o yaml | grep -A 10 results:- Stream logs from any stage:
kelos logs scaffold -f
kelos logs write-tests -f
kelos logs open-pr -f- Cleanup:
kubectl delete -f examples/07-task-pipeline/You can create the same pipeline with the CLI:
kelos run -p "Scaffold a user authentication module" \
--name scaffold --branch feature/auth --workspace my-workspace -w
kelos run -p 'Write tests for the auth module on branch {{index .Deps "scaffold" "Results" "branch"}}' \
--name write-tests --depends-on scaffold --branch feature/auth --workspace my-workspace -w
kelos run -p 'Open a PR for branch {{index .Deps "write-tests" "Results" "branch"}}' \
--name open-pr --depends-on write-tests --branch feature/auth --workspace my-workspace -w- All three Tasks share the same
branchvalue. This means even withoutdependsOn, the branch lock would serialize them. AddingdependsOnensures strict ordering and enables result passing. - If
scaffoldfails, bothwrite-testsandopen-prfail immediately with a "dependency failed" message. - Set
ttlSecondsAfterFinishedon each Task if you want automatic cleanup after the pipeline completes.