PAIDF Orchestration — Event Video Generation
Run the Event Video Generation DAG end to end: seed-image input preparation, Cosmos3
image-to-video anomaly augmentation, auto-labeling (detection and tracking, captioning,
anomaly visual QA, person-attribute visual QA, person attribute search), anomaly dataset
generation, and result retrieval.
DAG selection
The workflow builds one DAG per compute platform from
airflow/dags/workflows/event_video_generation_dag/:
| Platform |
DAG ID |
Manifest |
| Kubernetes |
event_video_generation_dag_k8s |
event_video_generation_k8s_manifest.yaml |
Kubernetes is the only platform whose manifest is checked in, so
event_video_generation_dag_k8s is the only DAG this repository registers. A DAG is
registered only if its manifest exists; a missing manifest means the DAG is absent from Airflow
rather than broken. List the DAGs Airflow actually loaded before triggering, and never name a DAG
ID that is not in that list.
There is a single end-to-end pipeline — there are no generation-only or labeling-only DAG
variants. If a user asks for video generation without auto-labeling, tell them the checked-in DAG
does not offer that flow rather than inventing a DAG ID.
Manual payload entry in the Airflow UI
If the user wants to enter their own payload directly in the Airflow UI rather than have you
construct and trigger one, your job is limited to getting them to the UI: confirm controller
readiness, ensure make port-forward is running (see
airflow-direct-api.md), and report the
reachable URL. Do not render a payload, run preflight, or trigger a run yourself in this case —
the user is doing that from the UI. Resume monitoring (step 6 below) once they tell you a run has
been triggered; you can find it via the Airflow API without needing the payload they used.
Scope
Before building any payload, collect all of the following from the user. Do not fall back to
repository defaults, CI payloads, or any hardcoded endpoint URL or bucket path.
| Required |
Field |
What to ask |
| Always |
input_path |
S3 (or HTTP/HTTPS) URL to a single seed image or a directory of seed images |
| Always |
output_directory |
Writable S3 URL where results should be written |
| Always |
service mode |
external (user provides endpoint URLs) or internal (DAG deploys services in-cluster) |
| External mode |
cosmos.vlm_service_url |
Full HTTPS URL for the VLM inference endpoint |
| External mode |
cosmos.llm_service_url |
Full HTTPS URL for the LLM inference endpoint |
| External mode |
cosmos.image2video_service_url |
Full HTTPS URL for the Cosmos3 image-to-video inference endpoint |
| Optional |
max_images |
Number of images to process from a directory (default: 10; 0 or negative = all) |
| Optional |
cosmos.num_augmentation |
Anomaly videos generated per image (default: 1) |
| Optional |
cosmos.variable_distribution |
anomaly_type / env_type sampling distribution (see payload-contract.md) |
If the user does not provide a required value, ask for it explicitly before proceeding. Do not
invent or reuse values from previous runs or checked-in files.
Always run the following readiness checks before triggering a run. The checks are
short-circuiting — stop at the first failure and route to the environment-setup skill immediately.
Before any check, establish the cluster connection. The cluster is reached only through
credentials the user supplies — they are never part of the repository. Check whether the cluster
credential file path is already exported in the shell environment; if not, ask the user for the
absolute path before running any cluster command. Never assume a path or fall back to any on-disk
default — see setup-and-preflight.md for the
full procedure.
The controller (Airflow) and DAG compute tasks run on the same cluster unless a different remote
cluster connection was configured. GPU capacity is checked on this cluster.
Controller pods — check that the Airflow controller pods (not DAG task pods) are Running.
DAG task pods in Pending or Failed state are normal and must not be mistaken for controller
failures:
kubectl get pods -n sdg-workflow -l "release=sdg-workflow-controller"
All pods matching the release=sdg-workflow-controller label must be Running. If the
namespace is absent, this is a first-install condition — route to the environment-setup skill,
do not diagnose further.
Airflow API — reachable only if check 1 passes. First establish AIRFLOW_URL from the
Kubernetes ClusterIP (always routable from the host, no port-forward required):
AIRFLOW_URL="http://$(kubectl get svc -n sdg-workflow \
sdg-workflow-controller-api-server \
-o jsonpath='{.spec.clusterIP}'):8080"
Then confirm the target DAG is loaded and is_paused: False. See
airflow-direct-api.md for the full auth + check sequence.
If the API is unreachable, route to the environment-setup skill.
Pools — only if check 2 passes. Required pools with open slots: k8s_gpu_1,
default_pool, and the image2video pool for the chosen mode
(external_image2video_service_pool for external, internal_image2video_service_pool for
internal).
Compute-cluster GPUs — check the cluster (using the cluster connection established above):
kubectl get nodes \
-o custom-columns='NAME:.metadata.name,GPU_ALLOC:.status.allocatable.nvidia\.com/gpu'
# Also check pods already consuming GPUs — capacity ≠ availability on a shared cluster
kubectl get pods -n sdg-workflow \
--field-selector=status.phase=Running -o wide
The compute cluster is shared — other users' runs may be active. Report GPUs as
free-versus-total, not just allocatable. Two independent GPU sources, only one of which is
mode-dependent:
- Task pods that run local model inference regardless of service mode:
detection_and_tracking, captioning, and visual_qa all run on the k8s_gpu_task profile
(1 GPU each) — this cost applies in both external and internal mode, since these do in-pod
inference rather than calling an endpoint. event_and_person_attribute_search and
augmentation run on CPU profiles and cost nothing. External mode therefore needs a minimum
of three GPUs, not zero.
- Internally deployed endpoints (
external_services: false): one GPU per VLM/LLM replica,
plus two GPUs per image2video replica (gpu_count: 2, host_ipc: true) — four GPUs for
one replica of each service.
- Internal mode total = both sources combined: the three task-pod GPUs plus the four
endpoint GPUs — at minimum seven GPUs, not four.
Stale failed pods — before triggering, check for accumulated failed pods in the compute
namespace and report them. They are retained by design and do not affect run correctness, but
they consume namespace quota and clutter log searches:
kubectl get pods -n sdg-workflow \
--field-selector=status.phase=Failed \
-o custom-columns='NAME:.metadata.name,AGE:.metadata.creationTimestamp,DAG:.metadata.labels.dag_id'
Clean up only pods whose dag_id label matches a run you own, after confirming with the user.
Document each check result explicitly.
If any check fails: invoke the environment-setup skill automatically — do not wait for the user
to say "set up" or ask them to name the skill.
If the user's request implies first-time or explicit deployment ("deploy", "install", "set up",
"reinstall", "redeploy", "full setup"): invoke the environment-setup skill even if all checks
pass, and confirm the planned commands first.
If all checks pass and the user only wants to run the workflow: proceed directly to payload
and trigger.
Bundled tools
scripts/upload_images.py: validate/upload a local seed image or flat directory of seed images.
scripts/payload.py: render or validate a standalone
EventVideoGenerationDagPayloadConfig-compatible JSON.
scripts/summarize_results.py: summarize a downloaded anomaly_dataset/dataset.json dataset.
Run commands from this skill directory. Credentials must be inherited from the shell that launched
the agent; never ask the user to paste secret values into the prompt.
Procedure
Determine the input source.
For local data, validate before upload:
python scripts/upload_images.py --path /path/to/seed-images --validate-only
Then upload:
python scripts/upload_images.py \
--path /path/to/seed-images --destination-path event-video-generation/my-run
For an existing storage URL, use it unchanged after confirming it names either a single
image or a flat directory of images (.jpg, .jpeg, .png, .bmp, .gif, .tiff,
.webp). Unlike person-crop workflows, there is no subdirectory convention — every matching
file directly under input_path is one input image. When input_path names a directory,
the DAG sorts matching files and takes the first max_images of them.
Select service mode.
external requires explicit VLM, LLM, and image2video endpoint URLs.
internal lets the DAG's service lifecycle deploy all three services in-cluster.
- Choose service mode independently from controller placement. A local controller may use
external inference endpoints.
- Keep nested service mode and output directory consistent with the top level.
- On Kubernetes, VLM and LLM each claim one GPU from
k8s_gpu_1, but image2video claims
two GPUs per replica (gpu_count: 2, host_ipc: true) — four GPUs for the internally
deployed endpoints alone. That's on top of, not instead of, the three GPUs
detection_and_tracking/captioning/visual_qa always claim from k8s_gpu_task regardless
of service mode (see the readiness-check GPU breakdown above): external mode needs a
minimum of three allocatable GPUs, internal mode a minimum of seven — not zero and four.
Read payload-contract.md, then render a payload from the
values collected above. Do not copy checked-in dev or CI payloads — they contain deployment-
specific endpoint URLs and bucket paths that must not be inherited by user runs.
External:
python scripts/payload.py render \
--input-path s3://bucket/input/seed-images/ \
--output-directory s3://bucket/output/event-video-generation/ \
--service-mode external \
--vlm-url https://vlm.example/v1 \
--llm-url https://llm.example/v1 \
--image2video-url https://image2video.example/v1 \
--max-images 10 --num-augmentation 3 \
--variable-distribution assets/variable-distribution.json \
--output /tmp/evg-payload.json
Internal:
python scripts/payload.py render \
--input-path s3://bucket/input/seed-images/ \
--output-directory s3://bucket/output/event-video-generation/ \
--service-mode internal \
--max-images 10 --num-augmentation 3 \
--output /tmp/evg-payload.json
Show the user the rendered payload (or its validated contents) and get explicit confirmation
before proceeding. Only continue to preflight and triggering if they confirm; if they want
changes, re-render and re-confirm.
Preflight the DAG through the Airflow API. Check that the DAG is loaded, required pools have
slots, and controller pods are healthy — see
airflow-direct-api.md#preflight-direct-path.
Confirm presence only; never print credential values.
Submit exactly one DAG run. Pass the payload from step 3 as conf.payload — see
airflow-direct-api.md#trigger-a-run for the
full request shape. Record and return the dag_run_id, input path, output directory, and
service mode.
Immediately after triggering — without waiting to be asked — monitor the run until it reaches
a terminal state (success or failed). Poll the Airflow API every 60–120 seconds:
# Poll run state
RESPONSE=$(curl -s -H "Authorization: Bearer $TOKEN" \
"$AIRFLOW_URL/api/v2/dags/$DAG_ID/dagRuns/$RUN_ID")
RESPONSE="$RESPONSE" python3 -c "import json, os; print(json.loads(os.environ['RESPONSE'])['state'])"
For a per-task breakdown when state is running or failed, see
airflow-direct-api.md.
Stop polling as soon as the run state is success or failed. Use the polling loop that
fits your runtime — a shell while loop, a background process, or a tool-native scheduler.
Do not block the user waiting for each poll; report state changes as they occur.
Tell the user they can also watch progress live in the Airflow UI. make port-forward runs in
the foreground and never exits, so start it as a background job — and prefer that the user runs
it in their own terminal, since an agent-owned forward dies with the session. Resolve the host's
real address rather than reporting a placeholder or localhost, which is meaningless from
another machine:
HOST_IP=$(hostname -I | awk '{print $1}')
echo "Airflow UI: http://$HOST_IP:8080"
Default credentials are admin/admin, defined in deploy/values.yaml under
airflow.createUserJob.defaultUser (not webserver.defaultUser). Update them before
production use.
For a full per-task breakdown see
airflow-direct-api.md.
To stop an in-progress run: open the Airflow UI, find the active DagRun, locate the running
task, and mark it Failed (task menu → Mark Failed). This triggers the DAG's shutdown path,
cleaning up Deployments, Services, and GPU pods. Do not delete the DagRun or the DAG — that
bypasses cleanup and leaves stale cluster resources.
After the run reaches success or failed, ask the user:
"Would you like to download and analyze the results?"
Do not download automatically — wait for confirmation.
If the user confirms, use whatever AWS credentials are already available in the shell
environment (standard AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY / AWS_DEFAULT_REGION,
an AWS profile, or instance role). Never ask the user to paste credentials into the prompt.
Run artifacts live under <output_directory>/<run_id>/, where <output_directory> is the
payload value and <run_id> is the dag_run_id from step 5. The final dataset is in
anomaly_dataset/:
aws s3 sync "<output_directory>/<run_id>/anomaly_dataset/" /tmp/evg-results/
python scripts/summarize_results.py --results-dir /tmp/evg-results
To inspect intermediate generated videos instead, sync <output_directory>/<run_id>/cosmos/
and read metadata.json from each <video_key>/<augmentation_index>/ folder.
Read outputs.md before interpreting files.
Guardrails
- Never use default endpoint URLs, bucket paths, or input paths from the codebase or
checked-in payloads. Always ask the user for every deployment-specific value before building
a payload. If a required value is missing, stop and ask — do not substitute a guess.
- Preserve explicit user inputs and endpoint/model selections throughout the session.
- Do not submit if payload validation, local dataset validation, or Airflow preflight fails.
- Do not show AWS credentials, Airflow bearer tokens, or S3 signed URLs.
- Do not start multiple runs unless the user explicitly requests them.
- Ask for a dataset location if none was supplied; this workflow has no implicit demo dataset.
- Do not invent generation-only or labeling-only DAG IDs — only the DAG listed above exists.
- Only offer a platform whose manifest exists and whose DAG is loaded in Airflow.
- Do not route person-crop clothing/attribute augmentation requests here — that is
image-attribute-augmentation-workflow.
References
- Read setup-and-preflight.md for environment, storage, and
policy requirements.
- Read payload-contract.md when creating or changing a payload.
- Read outputs.md when retrieving or interpreting results.
- Read troubleshooting.md after validation, API, or runtime errors.
- Read airflow-direct-api.md for all Airflow interactions:
preflight, triggering, monitoring, per-task breakdown, and log retrieval.
1---2name: physical-ai-event-video-generation3description: Run the PAIDF Orchestration Event Video Generation DAG on Kubernetes - image-to-video anomaly generation, auto-labeling, and anomaly dataset generation. Select for requests about event video generation, anomaly video generation, image-to-video synthesis, Cosmos3 image2video, anomaly dataset creation, safety/surveillance SDG, or generating person-falling, person-climbing, person-running, fighting, smoking/vaping, fire/smoke, or shoplifting video clips from a seed image. Runs environment setup first when controller readiness is unknown. Not for person-crop clothing/attribute augmentation (that is image-attribute-augmentation-workflow) and not for video style transfer.4license: CC-BY-4.0 AND Apache-2.05---67# PAIDF Orchestration — Event Video Generation89Run the Event Video Generation DAG end to end: seed-image input preparation, Cosmos310image-to-video anomaly augmentation, auto-labeling (detection and tracking, captioning,11anomaly visual QA, person-attribute visual QA, person attribute search), anomaly dataset12generation, and result retrieval.1314## DAG selection1516The workflow builds one DAG per compute platform from17`airflow/dags/workflows/event_video_generation_dag/`:1819| Platform | DAG ID | Manifest |20|---|---|---|21| Kubernetes | `event_video_generation_dag_k8s` | `event_video_generation_k8s_manifest.yaml` |2223Kubernetes is the only platform whose manifest is checked in, so24`event_video_generation_dag_k8s` is the only DAG this repository registers. A DAG is25registered only if its manifest exists; a missing manifest means the DAG is absent from Airflow26rather than broken. List the DAGs Airflow actually loaded before triggering, and never name a DAG27ID that is not in that list.2829There is a **single end-to-end pipeline** — there are no generation-only or labeling-only DAG30variants. If a user asks for video generation without auto-labeling, tell them the checked-in DAG31does not offer that flow rather than inventing a DAG ID.3233## Manual payload entry in the Airflow UI3435If the user wants to enter their own payload directly in the Airflow UI rather than have you36construct and trigger one, your job is limited to getting them to the UI: confirm controller37readiness, ensure `make port-forward` is running (see38[airflow-direct-api.md](references/airflow-direct-api.md#port-forward-ui-access)), and report the39reachable URL. Do not render a payload, run preflight, or trigger a run yourself in this case —40the user is doing that from the UI. Resume monitoring (step 6 below) once they tell you a run has41been triggered; you can find it via the Airflow API without needing the payload they used.4243## Scope4445**Before building any payload, collect all of the following from the user.** Do not fall back to46repository defaults, CI payloads, or any hardcoded endpoint URL or bucket path.4748| Required | Field | What to ask |49|---|---|---|50| Always | `input_path` | S3 (or HTTP/HTTPS) URL to a single seed image or a directory of seed images |51| Always | `output_directory` | Writable S3 URL where results should be written |52| Always | service mode | `external` (user provides endpoint URLs) or `internal` (DAG deploys services in-cluster) |53| External mode | `cosmos.vlm_service_url` | Full HTTPS URL for the VLM inference endpoint |54| External mode | `cosmos.llm_service_url` | Full HTTPS URL for the LLM inference endpoint |55| External mode | `cosmos.image2video_service_url` | Full HTTPS URL for the Cosmos3 image-to-video inference endpoint |56| Optional | `max_images` | Number of images to process from a directory (default: 10; 0 or negative = all) |57| Optional | `cosmos.num_augmentation` | Anomaly videos generated per image (default: 1) |58| Optional | `cosmos.variable_distribution` | anomaly_type / env_type sampling distribution (see payload-contract.md) |5960If the user does not provide a required value, ask for it explicitly before proceeding. Do not61invent or reuse values from previous runs or checked-in files.6263**Always run the following readiness checks before triggering a run.** The checks are64short-circuiting — stop at the first failure and route to the environment-setup skill immediately.6566**Before any check**, establish the cluster connection. The cluster is reached only through67credentials the user supplies — they are never part of the repository. Check whether the cluster68credential file path is already exported in the shell environment; if not, ask the user for the69absolute path before running any cluster command. Never assume a path or fall back to any on-disk70default — see [setup-and-preflight.md](references/setup-and-preflight.md#cluster-access) for the71full procedure.7273The controller (Airflow) and DAG compute tasks run on the same cluster unless a different remote74cluster connection was configured. GPU capacity is checked on this cluster.75761. **Controller pods** — check that the Airflow controller pods (not DAG task pods) are Running.77 DAG task pods in `Pending` or `Failed` state are normal and must not be mistaken for controller78 failures:7980 ```bash81 kubectl get pods -n sdg-workflow -l "release=sdg-workflow-controller"82 ```8384 All pods matching the `release=sdg-workflow-controller` label must be `Running`. If the85 namespace is absent, this is a first-install condition — route to the environment-setup skill,86 do not diagnose further.87882. **Airflow API** — reachable only if check 1 passes. First establish `AIRFLOW_URL` from the89 Kubernetes ClusterIP (always routable from the host, no port-forward required):9091 ```bash92 AIRFLOW_URL="http://$(kubectl get svc -n sdg-workflow \93 sdg-workflow-controller-api-server \94 -o jsonpath='{.spec.clusterIP}'):8080"95 ```9697 Then confirm the target DAG is loaded and `is_paused: False`. See98 [airflow-direct-api.md](references/airflow-direct-api.md) for the full auth + check sequence.99 If the API is unreachable, route to the environment-setup skill.1001013. **Pools** — only if check 2 passes. Required pools with open slots: `k8s_gpu_1`,102 `default_pool`, and the image2video pool for the chosen mode103 (`external_image2video_service_pool` for external, `internal_image2video_service_pool` for104 internal).1051064. **Compute-cluster GPUs** — check the cluster (using the cluster connection established above):107108 ```bash109 kubectl get nodes \110 -o custom-columns='NAME:.metadata.name,GPU_ALLOC:.status.allocatable.nvidia\.com/gpu'111 # Also check pods already consuming GPUs — capacity ≠ availability on a shared cluster112 kubectl get pods -n sdg-workflow \113 --field-selector=status.phase=Running -o wide114 ```115116 The compute cluster is **shared** — other users' runs may be active. Report GPUs as117 free-versus-total, not just allocatable. Two independent GPU sources, only one of which is118 mode-dependent:119 - **Task pods that run local model inference regardless of service mode**:120 `detection_and_tracking`, `captioning`, and `visual_qa` all run on the `k8s_gpu_task` profile121 (1 GPU each) — this cost applies in **both** external and internal mode, since these do in-pod122 inference rather than calling an endpoint. `event_and_person_attribute_search` and123 `augmentation` run on CPU profiles and cost nothing. **External mode therefore needs a minimum124 of three GPUs**, not zero.125 - **Internally deployed endpoints** (`external_services: false`): one GPU per VLM/LLM replica,126 plus **two** GPUs per image2video replica (`gpu_count: 2`, `host_ipc: true`) — four GPUs for127 one replica of each service.128 - **Internal mode total = both sources combined**: the three task-pod GPUs plus the four129 endpoint GPUs — **at minimum seven GPUs**, not four.1301315. **Stale failed pods** — before triggering, check for accumulated failed pods in the compute132 namespace and report them. They are retained by design and do not affect run correctness, but133 they consume namespace quota and clutter log searches:134135 ```bash136 kubectl get pods -n sdg-workflow \137 --field-selector=status.phase=Failed \138 -o custom-columns='NAME:.metadata.name,AGE:.metadata.creationTimestamp,DAG:.metadata.labels.dag_id'139 ```140141 Clean up only pods whose `dag_id` label matches a run you own, after confirming with the user.142143Document each check result explicitly.144145**If any check fails**: invoke the environment-setup skill automatically — do not wait for the user146to say "set up" or ask them to name the skill.147148**If the user's request implies first-time or explicit deployment** ("deploy", "install", "set up",149"reinstall", "redeploy", "full setup"): invoke the environment-setup skill even if all checks150pass, and confirm the planned commands first.151152**If all checks pass** and the user only wants to run the workflow: proceed directly to payload153and trigger.154155## Bundled tools156157- `scripts/upload_images.py`: validate/upload a local seed image or flat directory of seed images.158- `scripts/payload.py`: render or validate a standalone159 `EventVideoGenerationDagPayloadConfig`-compatible JSON.160- `scripts/summarize_results.py`: summarize a downloaded `anomaly_dataset/dataset.json` dataset.161162Run commands from this skill directory. Credentials must be inherited from the shell that launched163the agent; never ask the user to paste secret values into the prompt.164165## Procedure1661671. Determine the input source.168 - For local data, validate before upload:169170 ```bash171 python scripts/upload_images.py --path /path/to/seed-images --validate-only172 ```173174 - Then upload:175176 ```bash177 python scripts/upload_images.py \178 --path /path/to/seed-images --destination-path event-video-generation/my-run179 ```180181 - For an existing storage URL, use it unchanged after confirming it names either a single182 image or a flat directory of images (`.jpg`, `.jpeg`, `.png`, `.bmp`, `.gif`, `.tiff`,183 `.webp`). Unlike person-crop workflows, there is no subdirectory convention — every matching184 file directly under `input_path` is one input image. When `input_path` names a directory,185 the DAG sorts matching files and takes the first `max_images` of them.1861872. Select service mode.188 - `external` requires explicit VLM, LLM, and image2video endpoint URLs.189 - `internal` lets the DAG's service lifecycle deploy all three services in-cluster.190 - Choose service mode independently from controller placement. A local controller may use191 external inference endpoints.192 - Keep nested service mode and output directory consistent with the top level.193 - On Kubernetes, VLM and LLM each claim one GPU from `k8s_gpu_1`, but image2video claims194 **two** GPUs per replica (`gpu_count: 2`, `host_ipc: true`) — four GPUs for the internally195 deployed endpoints alone. That's on top of, not instead of, the three GPUs196 `detection_and_tracking`/`captioning`/`visual_qa` always claim from `k8s_gpu_task` regardless197 of service mode (see the readiness-check GPU breakdown above): **external mode needs a198 minimum of three allocatable GPUs, internal mode a minimum of seven** — not zero and four.1992003. Read [payload-contract.md](references/payload-contract.md), then render a payload from the201 values collected above. Do not copy checked-in dev or CI payloads — they contain deployment-202 specific endpoint URLs and bucket paths that must not be inherited by user runs.203204 External:205206 ```bash207 python scripts/payload.py render \208 --input-path s3://bucket/input/seed-images/ \209 --output-directory s3://bucket/output/event-video-generation/ \210 --service-mode external \211 --vlm-url https://vlm.example/v1 \212 --llm-url https://llm.example/v1 \213 --image2video-url https://image2video.example/v1 \214 --max-images 10 --num-augmentation 3 \215 --variable-distribution assets/variable-distribution.json \216 --output /tmp/evg-payload.json217 ```218219 Internal:220221 ```bash222 python scripts/payload.py render \223 --input-path s3://bucket/input/seed-images/ \224 --output-directory s3://bucket/output/event-video-generation/ \225 --service-mode internal \226 --max-images 10 --num-augmentation 3 \227 --output /tmp/evg-payload.json228 ```229230 Show the user the rendered payload (or its validated contents) and get explicit confirmation231 before proceeding. Only continue to preflight and triggering if they confirm; if they want232 changes, re-render and re-confirm.2332344. Preflight the DAG through the Airflow API. Check that the DAG is loaded, required pools have235 slots, and controller pods are healthy — see236 [airflow-direct-api.md#preflight-direct-path](references/airflow-direct-api.md#preflight-direct-path).237 Confirm presence only; never print credential values.2382395. Submit exactly one DAG run. Pass the payload from step 3 as `conf.payload` — see240 [airflow-direct-api.md#trigger-a-run](references/airflow-direct-api.md#trigger-a-run) for the241 full request shape. Record and return the `dag_run_id`, input path, output directory, and242 service mode.2432446. Immediately after triggering — without waiting to be asked — monitor the run until it reaches245 a terminal state (`success` or `failed`). Poll the Airflow API every 60–120 seconds:246247 ```bash248 # Poll run state249 RESPONSE=$(curl -s -H "Authorization: Bearer $TOKEN" \250 "$AIRFLOW_URL/api/v2/dags/$DAG_ID/dagRuns/$RUN_ID")251 RESPONSE="$RESPONSE" python3 -c "import json, os; print(json.loads(os.environ['RESPONSE'])['state'])"252 ```253254 For a per-task breakdown when state is `running` or `failed`, see255 [airflow-direct-api.md](references/airflow-direct-api.md#per-task-breakdown-useful-for-diagnosing-failures).256257 Stop polling as soon as the run state is `success` or `failed`. Use the polling loop that258 fits your runtime — a shell `while` loop, a background process, or a tool-native scheduler.259 Do not block the user waiting for each poll; report state changes as they occur.260261 Tell the user they can also watch progress live in the Airflow UI. `make port-forward` runs in262 the foreground and never exits, so start it as a background job — and prefer that the user runs263 it in their own terminal, since an agent-owned forward dies with the session. Resolve the host's264 real address rather than reporting a placeholder or `localhost`, which is meaningless from265 another machine:266267 ```bash268 HOST_IP=$(hostname -I | awk '{print $1}')269 echo "Airflow UI: http://$HOST_IP:8080"270 ```271272 Default credentials are `admin`/`admin`, defined in `deploy/values.yaml` under273 `airflow.createUserJob.defaultUser` (not `webserver.defaultUser`). Update them before274 production use.275276 For a full per-task breakdown see277 [airflow-direct-api.md](references/airflow-direct-api.md#per-task-breakdown-useful-for-diagnosing-failures).278279 To stop an in-progress run: open the Airflow UI, find the active DagRun, locate the running280 task, and mark it **Failed** (task menu → Mark Failed). This triggers the DAG's shutdown path,281 cleaning up Deployments, Services, and GPU pods. Do not delete the DagRun or the DAG — that282 bypasses cleanup and leaves stale cluster resources.2832847. After the run reaches `success` or `failed`, ask the user:285 **"Would you like to download and analyze the results?"**286 Do not download automatically — wait for confirmation.287288 If the user confirms, use whatever AWS credentials are already available in the shell289 environment (standard `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` / `AWS_DEFAULT_REGION`,290 an AWS profile, or instance role). Never ask the user to paste credentials into the prompt.291 Run artifacts live under `<output_directory>/<run_id>/`, where `<output_directory>` is the292 payload value and `<run_id>` is the `dag_run_id` from step 5. The final dataset is in293 `anomaly_dataset/`:294295 ```bash296 aws s3 sync "<output_directory>/<run_id>/anomaly_dataset/" /tmp/evg-results/297 python scripts/summarize_results.py --results-dir /tmp/evg-results298 ```299300 To inspect intermediate generated videos instead, sync `<output_directory>/<run_id>/cosmos/`301 and read `metadata.json` from each `<video_key>/<augmentation_index>/` folder.302303 Read [outputs.md](references/outputs.md) before interpreting files.304305## Guardrails306307- **Never use default endpoint URLs, bucket paths, or input paths from the codebase or308 checked-in payloads.** Always ask the user for every deployment-specific value before building309 a payload. If a required value is missing, stop and ask — do not substitute a guess.310- Preserve explicit user inputs and endpoint/model selections throughout the session.311- Do not submit if payload validation, local dataset validation, or Airflow preflight fails.312- Do not show AWS credentials, Airflow bearer tokens, or S3 signed URLs.313- Do not start multiple runs unless the user explicitly requests them.314- Ask for a dataset location if none was supplied; this workflow has no implicit demo dataset.315- Do not invent generation-only or labeling-only DAG IDs — only the DAG listed above exists.316- Only offer a platform whose manifest exists and whose DAG is loaded in Airflow.317- Do not route person-crop clothing/attribute augmentation requests here — that is318 `image-attribute-augmentation-workflow`.319320## References321322- Read [setup-and-preflight.md](references/setup-and-preflight.md) for environment, storage, and323 policy requirements.324- Read [payload-contract.md](references/payload-contract.md) when creating or changing a payload.325- Read [outputs.md](references/outputs.md) when retrieving or interpreting results.326- Read [troubleshooting.md](references/troubleshooting.md) after validation, API, or runtime errors.327- Read [airflow-direct-api.md](references/airflow-direct-api.md) for all Airflow interactions:328 preflight, triggering, monitoring, per-task breakdown, and log retrieval.