| name | haipipe-task-for-endpoint |
| description | endpoint task-folder specialist: scaffolds AND executes {NN}_<name>/ task-folders that package a trained ModelInstance_Set into a deployable Endpoint_Set (Stage 6) via c_endpoint_nb.py. Called by /haipipe-task when task-type=endpoint. Cross-references /haipipe-end for Fn authoring and deploy targets. |
| argument-hint | [project_id] [group] [task-name] |
| allowed-tools | Bash, Read, Write, Edit, Grep, Glob, Skill |
| metadata | {"version":"0.2.3","last_updated":"2026-07-08","summary":"endpoint task-folder specialist (scaffold + execute + deploy prep)."} |
Skill: haipipe-task-for-endpoint
Scaffolds an endpoint task-folder (default C-series; letters are project-specific).
Takes a trained ModelInstance_Set (Stage 5, with examples) and packages it into a self-contained Endpoint_Set (Stage 6) using Endpoint_Pipeline.
The task .py is an exact copy of code/scripts/haistepnb/c_endpoint_nb.py.
CONFIG is overridden at runtime by papermill, NOT by editing the file.
Invocation modes: interactive (human steers) OR headless (haipipe-task-creator-agent calls this skill during Phase 2: Build).
Position in the ABC pipeline
A-series → B-series → C-series → Deploy
data model endpoint (local / databricks / sagemaker)
(aa/ab/ac/ad) (b_model_nb) (c_endpoint_nb)
haipipe-task-for-data haipipe-task-for-fit haipipe-task-for-endpoint
↓
/haipipe-end deploy <target>
What this scaffolds
tasks/C{NN}_{group_name}/
└── {NN}_{task_name}/
├── 1_{task_name}.py ← exact copy of c_endpoint_nb.py
├── configs/
│ └── run_{task_name}.yaml ← endpoint config (5 Fn names + model ref)
├── runs/
│ └── run_{task_name}.sh ← papermill runner
├── results/ ← (created at runtime)
└── notebooks/ ← (created at runtime)
Config YAML structure
Seeded from ref/config-seed.yaml:
modelinstance_name: "<name>"
modelinstance_version: "<version>"
endpoint_name: "<endpoint_name>"
endpoint_version: "<version>"
MetaFn: "<MetaFnName>"
TrigFn: "<TrigFnName>"
PostFn: "<PostFnName>"
Src2InputFn: "<Src2InputFnName>"
Input2SrcFn: "<Input2SrcFnName>"
deployment_config:
environment: "dev"
platform: "local"
Pipeline flow (c_endpoint_nb.py steps)
[1] Load ModelInstance_Set (with examples from ExampleConfig)
[2] Endpoint_Pipeline.run()
→ loads examples from ModelInstance_Set.examples_data
→ Src2InputFn(ProcName_to_ProcDf) → payload.json per example
→ packages Endpoint_Set
[3] Save to 6-EndpointStore/
[4] Verify examples have payload.json
[5] Test inference with sample payloads
[6] Package for deployment (.tar.gz)
Output structure:
6-EndpointStore/{endpoint_name}/ (canonical layout: ../../haipipe-end/ref/0-overview.md)
├── model/ ← copied from ModelInstance_Set
├── code/ ← codebase snapshot (haipipe, hainn, haifn)
├── examples/ ← from ModelInstance_Set + payload.json
│ ├── example_000/
│ │ ├── ProcName_to_ProcDf/ real source data (parquet)
│ │ ├── payload.json generated by Src2InputFn
│ │ ├── example_info.json case identifiers
│ │ ├── prediction_results.json
│ │ └── df_case_example.json
│ └── ...
├── meta.json ← MetaFn output (name mappings + metadata)
└── manifest.json ← config + full lineage chain
Prerequisites
-
Stage 5 complete with examples:
ModelInstance_Set must have examples_data (from ExampleConfig in training config)
- Each example has
ProcName_to_ProcDf/ (real patient source data as parquet)
-
5 Fns authored in code/haifn/fn_endpoint/:
- Build via the endpoint fn_develop task folder’s
{a1,b1,c1,d1,e1}_build_*.py (legacy: code-dev/1-PIPELINE/6-Endpoint-WorkSpace/)
- OR use
/haipipe-end <fn-type> design interactively
-
ExampleConfig in B-series training config:
ExampleConfig:
enabled: true
ExampleFnName: <name>
num_examples: 3
Execution
CLI (A layer):
python code/scripts/haistepcli/endpoint.py \
--config examples/.../C01_.../configs/run_endpoint_*.yaml
Notebook (B layer — papermill):
papermill 1_endpoint_*.ipynb output.ipynb \
-p CONFIG examples/.../C01_.../configs/run_endpoint_*.yaml
After packaging → deploy
/haipipe-end deploy local <endpoint> ← FastAPI on localhost
/haipipe-end deploy databricks <endpoint> ← Databricks Model Serving
/haipipe-end deploy sagemaker <endpoint> ← AWS SageMaker
Latency profiling (formerly this skill's scope) is now a verb:
/haipipe-end profile <endpoint>
Cross-references
/haipipe-end — Fn authoring, endpointset verbs, deploy targets
/haipipe-task-for-fit — B-series training (produces the ModelInstance_Set)
/haipipe-task-for-data — A-series data pipeline (produces the AIDataSet)
code/scripts/haistepnb/c_endpoint_nb.py — the template
code/scripts/haistepcli/endpoint.py — the CLI entry point
ref/notebook-templates.md (in haipipe-task-for-data) — full ABC template guide
Scaffold flow
- Identify project + task-group (letter C).
- Collect metadata (NN, name, model ref, 5 Fn names, _meta).
- Copy
c_endpoint_nb.py to task folder (exact copy).
- Seed config from
ref/config-seed.yaml.
- Create
runs/run_{task_name}.sh from template.
- Emit return contract.
MUST NOT
- Edit the template
.py — it is an exact copy of c_endpoint_nb.py.
- Put project configs in
code/scripts/haistepconfig/ — those are reference templates only.
- Skip
ExampleConfig in training — without examples, no payload.json.
- Create
README.md.
Return contract
status: ok | blocked | failed
task_folder: <path to scaffolded task folder>
run_name: run_{task_name}
files: [1_{task_name}.py, configs/run_{task_name}.yaml, runs/run_{task_name}.sh]
next: run the task, then /haipipe-end deploy <target>