runbios-mcp 0.6.1-rc.372 → 0.6.2-dev.400

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.js CHANGED
@@ -153,7 +153,7 @@ const CATALOG_RECOVERY = "Pick an id from the Run BiOS catalog: call list_models
153
153
  + "either one answers from the same registry. If BOTH are unavailable, do NOT guess another id: any id already returned "
154
154
  + "by list_inferences or list_training_jobs is known-hosted, the same catalog is on the Models page of the Run BiOS console, "
155
155
  + "and get_platform_guide (topic \"models\") states the rule. When nothing can confirm an id, report the catalog as "
156
- + "unavailable instead of retrying with an unverified one.";
156
+ + "unavailable instead of retrying with an unlisted one.";
157
157
  /* ─── Context-length policy (owner-mandated, enforced server-side) ───
158
158
  * The window is DERIVED unless the caller overrides it: the default is
159
159
  * min(model native max, 262144), a model whose native window is unknown falls
@@ -237,7 +237,7 @@ const PRICE_CAP_TOOL_MAX = 100_000;
237
237
  const priceCapPolicyText = (floor) => "This is SPEND CONSENT, not a filter: the maximum accepted TOTAL hourly price for the complete GPU count, in cents. "
238
238
  + "Copy the cap the user approved from the preflight response (billing.max_price_hour_cents, or the chosen placement's "
239
239
  + "total_price_hour_cents) — never invent one. The server rejects a cap BELOW the primary placement's current price, and "
240
- + `omitting it accepts the verified price of the placements already approved. The ${floor}-${PRICE_CAP_TOOL_MAX} range here `
240
+ + `omitting it accepts the current price of the placements already approved. The ${floor}-${PRICE_CAP_TOOL_MAX} range here `
241
241
  + "is a sanity bound on consent (the dearest configuration the GPU catalog can book is well under it), not a price quote and "
242
242
  + "not a per-model ceiling; get_gpu_pricing and preflight give the real numbers.";
243
243
  /**
@@ -255,8 +255,8 @@ function priceCapSchema(allowZero) {
255
255
  .min(floor, {
256
256
  error: (issue) => `max_price_hour_cents ${String(issue.input)} is below ${floor}. `
257
257
  + (allowZero
258
- ? "A cap cannot be negative; pass 0 (or omit it) to accept the verified placement price. "
259
- : "Omit it instead of passing 0 or a negative number to accept the verified placement price. ")
258
+ ? "A cap cannot be negative; pass 0 (or omit it) to accept the current placement price. "
259
+ : "Omit it instead of passing 0 or a negative number to accept the current placement price. ")
260
260
  + policy,
261
261
  })
262
262
  .max(PRICE_CAP_TOOL_MAX, {
@@ -308,7 +308,7 @@ const deploymentCreateToolSchema = {
308
308
  name: z.string().min(1).max(255).describe("Deployment display name."),
309
309
  source_type: z
310
310
  .enum(DEPLOYMENT_SOURCE_TYPES)
311
- .describe("Deploy a verified training checkpoint or a base model from the catalog."),
311
+ .describe("Deploy a completed training checkpoint or a base model from the catalog."),
312
312
  source_job_id: z
313
313
  .string()
314
314
  .optional()
@@ -316,7 +316,7 @@ const deploymentCreateToolSchema = {
316
316
  source_checkpoint_id: z
317
317
  .string()
318
318
  .optional()
319
- .describe("Verified checkpoint ID; required with source_type=checkpoint."),
319
+ .describe("Completed checkpoint ID; required with source_type=checkpoint."),
320
320
  hf_model_id: z
321
321
  .string()
322
322
  .optional()
@@ -360,9 +360,9 @@ const deploymentCreateToolSchema = {
360
360
  .describe("Tensor-parallel GPU count accepted by the model-fit option."),
361
361
  gpu_priorities: z
362
362
  .array(z.object({
363
- gpu_type: z.string().min(1), gpu_count: z.number().int().min(1).max(8),
364
- provider: z.string().min(1).max(30).optional(), region: z.string().min(1).max(64).optional(),
365
- tier: z.literal("secure").optional(),
363
+ gpu_type: z.string().min(1).describe("GPU identifier offered by the placement or pricing result for this workload."), gpu_count: z.number().int().min(1).max(8).describe("Number of that GPU to reserve together for this placement."),
364
+ provider: z.string().min(1).max(30).optional().describe("Provider identifier returned for this placement. Omit to let the platform choose an eligible provider."), region: z.string().min(1).max(64).optional().describe("Region code returned for this placement. Set it when the workload must stay in that region."),
365
+ tier: z.literal("secure").optional().describe("Placement tier from the available options."),
366
366
  }))
367
367
  .min(1)
368
368
  .max(5)
@@ -377,7 +377,7 @@ const deploymentCreateToolSchema = {
377
377
  .optional()
378
378
  .describe("Explicit consent to wait up to seven days if this exact SKU is unavailable; defaults to false."),
379
379
  max_price_hour_cents: priceCapSchema(false),
380
- storage_gb: z.number().int().min(1).max(10000).optional(),
380
+ storage_gb: z.number().int().min(1).max(10000).optional().describe("Disk capacity in GB requested for the deployment."),
381
381
  context_length: contextLengthSchema("Serving context window in tokens."),
382
382
  quant: quantSchema("Runtime precision. Pre-quantized checkpoint precision may be locked."),
383
383
  serving_config: z
@@ -614,24 +614,26 @@ const FINAL_MODEL_DELETED_BY = {
614
614
  member: "by a member of this workspace",
615
615
  };
616
616
  /**
617
- * What a completed run's final model is now, from final_artifact_state in the
618
- * same response. A model that was saved and verified and later deleted on
619
- * purpose is "deleted", never a failed save. Null when the response does not
620
- * say (a run that is not completed, or an older backend).
617
+ * What a completed run's final model is now: "saved", "deleted" (saved, then
618
+ * deleted on purpose -- never a failed save) or "unavailable". Read from
619
+ * final_model_state, falling back to the legacy final_artifact_state ("verified"
620
+ * there means "saved"). Null when the response does not say (a run that is not
621
+ * completed, or an older backend).
621
622
  */
622
623
  function summarizeFinalModel(payload) {
623
- const state = nonEmptyString(payload.final_artifact_state);
624
+ const legacy = nonEmptyString(payload.final_artifact_state);
625
+ const state = nonEmptyString(payload.final_model_state) ?? (legacy === "verified" ? "saved" : legacy);
624
626
  if (payload.status !== "completed" || !state)
625
627
  return null;
626
628
  const deletedAt = nonEmptyString(payload.final_artifact_deleted_at) ?? null;
627
629
  const deletedBy = nonEmptyString(payload.final_artifact_deleted_by) ?? null;
628
630
  const byWhom = deletedBy ? (FINAL_MODEL_DELETED_BY[deletedBy] ?? (deletedBy.startsWith("system:") ? "by the platform" : null)) : null;
629
- const note = state === "verified"
630
- ? "The final model is saved and verified; it can be deployed or downloaded."
631
+ const note = state === "saved"
632
+ ? "The final model is saved complete; it can be deployed or downloaded."
631
633
  : state === "deleted"
632
- ? `Training succeeded and its final model was saved and verified, then deleted${deletedAt ? ` at ${deletedAt}` : ""}${byWhom ? ` ${byWhom}` : ""}. It can no longer be deployed or downloaded; this is not a failed save.`
633
- : "Training finished, but no committed final model could be verified. Do not deploy earlier checkpoints as this run's final model.";
634
- return { state, deployable: state === "verified", deleted_at: deletedAt, deleted_by: deletedBy, note };
634
+ ? `Training succeeded and its final model was saved complete, then deleted${deletedAt ? ` at ${deletedAt}` : ""}${byWhom ? ` ${byWhom}` : ""}. It can no longer be deployed or downloaded; this is not a failed save.`
635
+ : "Training finished, but no complete final model was saved. Do not deploy earlier checkpoints as this run's final model.";
636
+ return { state, deployable: state === "saved", deleted_at: deletedAt, deleted_by: deletedBy, note };
635
637
  }
636
638
  const TRAINING_PHASE_LABELS = {
637
639
  dataset_download: "downloading datasets",
@@ -814,15 +816,15 @@ launchGates = resolveLaunchGates(), allowedTools) {
814
816
  return m ? m[1] : v;
815
817
  }
816
818
  const datasetMixingSchema = z.object({
817
- mode: z.enum(["sequential", "shuffle", "interleave", "phased"]),
818
- seed: z.number().int().min(Number.MIN_SAFE_INTEGER).max(Number.MAX_SAFE_INTEGER).optional(),
819
- weights: z.array(z.number().nonnegative()).min(1).max(64).optional(),
819
+ mode: z.enum(["sequential", "shuffle", "interleave", "phased"]).describe("How to combine the selected datasets. Use phased to apply different sampling weights over successive portions of training."),
820
+ seed: z.number().int().min(Number.MIN_SAFE_INTEGER).max(Number.MAX_SAFE_INTEGER).optional().describe("Integer seed for reproducible ordering and sampling."),
821
+ weights: z.array(z.number().nonnegative()).min(1).max(64).optional().describe("Relative sampling weights in the same order as the selected dataset IDs."),
820
822
  phases: z.array(z.object({
821
- name: z.string().max(255).optional(),
822
- portion: z.number().positive().max(1),
823
- weights: z.array(z.number().nonnegative()).min(1).max(64).optional(),
824
- shuffle: z.boolean().optional(),
825
- })).min(1).optional(),
823
+ name: z.string().max(255).optional().describe("Optional label for this training phase."),
824
+ portion: z.number().positive().max(1).describe("Fraction of the training schedule assigned to this phase, from greater than zero through one."),
825
+ weights: z.array(z.number().nonnegative()).min(1).max(64).optional().describe("Relative sampling weights in the same order as the selected dataset IDs."),
826
+ shuffle: z.boolean().optional().describe("Whether to randomize sample order in this phase."),
827
+ })).min(1).optional().describe("Ordered portions of training, each with its share of the run and its dataset weights."),
826
828
  });
827
829
  // start_from on preflight and create (training-service training_start_from.go):
828
830
  // a new LoRA on top of earlier LoRA versions of the same base, oldest first.
@@ -837,24 +839,24 @@ launchGates = resolveLaunchGates(), allowedTools) {
837
839
  const trainingConfigurationSchema = {
838
840
  dataset_sample_limits: z.record(z.string(), z.number().int().min(0)).optional().describe("Per-dataset first-N row caps; keys must be selected dataset IDs. Omit or use 0 for the full source. Prefer dataset_sampling."),
839
841
  dataset_sampling: z.record(z.string(), z.object({
840
- rows: z.number().int().min(1).max(50_000_000).optional(),
841
- percent: z.number().gt(0).max(100).optional(),
842
+ rows: z.number().int().min(1).max(50_000_000).optional().describe("Number of usable rows to take from this dataset. Specify either rows or percent."),
843
+ percent: z.number().gt(0).max(100).optional().describe("Percentage of usable rows to take from this dataset. Specify either percent or rows."),
842
844
  })).optional().describe("Per-dataset sampling, keyed by selected dataset ID: exactly one of rows or percent (of the dataset's usable rows for the method). Asking for more than the dataset holds uses all of it and the run says so. Recorded in the mix manifest; a resume reproduces the same rows."),
843
845
  dataset_sampling_strategy: z.enum(["first", "random"]).optional().describe("How sampled rows are chosen: 'first' (default) keeps the first N rows in file order (a curriculum); 'random' draws a seeded uniform sample kept in file order."),
844
846
  epochs: z.number().positive().max(1000).optional().describe("Number of training epochs. Governs the full run when max_steps is omitted (the default)."),
845
847
  max_steps: z.number().int().min(1).max(10_000_000).optional().describe("Optional hard step cap that overrides epochs. Omit for no cap and all configured epochs; setting less than one epoch intentionally trains only part of the data."),
846
848
  learning_rate: z.number().positive().max(1).optional().describe("Learning rate."),
847
849
  max_seq_length: trainingSeqLengthSchema(),
848
- lora_rank: z.number().int().min(1).max(4096).optional(),
849
- lora_alpha: z.number().positive().max(1_000_000).optional(),
850
- warmup_ratio: z.number().min(0).max(1).optional(),
851
- weight_decay: z.number().min(0).max(10).optional(),
850
+ lora_rank: z.number().int().min(1).max(4096).optional().describe("Rank of the low-rank adapter matrices when training with LoRA or QLoRA."),
851
+ lora_alpha: z.number().positive().max(1_000_000).optional().describe("Adapter scaling parameter for LoRA or QLoRA. Use the model recommendation unless a particular scale is needed."),
852
+ warmup_ratio: z.number().min(0).max(1).optional().describe("Fraction of training spent warming up the learning rate."),
853
+ weight_decay: z.number().min(0).max(10).optional().describe("Optimizer weight decay coefficient. Zero disables this regularization."),
852
854
  scheduler: z
853
855
  .enum(["linear", "cosine", "cosine_with_restarts", "polynomial", "constant", "constant_with_warmup"])
854
856
  .optional()
855
857
  .describe("Learning-rate scheduler."),
856
- job_name: z.string().max(255).optional(),
857
- eval_split_ratio: z.number().min(0).max(0.99).optional(),
858
+ job_name: z.string().max(255).optional().describe("Human-readable name that identifies this run in the workspace's training history."),
859
+ eval_split_ratio: z.number().min(0).max(0.99).optional().describe("Fraction of the training data to reserve for validation. Omit when supplying separate evaluation datasets."),
858
860
  validation_rows: z.number().int().min(0).max(50_000_000).optional()
859
861
  .describe("Validation rows held out and never trained on (0 turns validation off). Allowed: 100 (or 5% when that is fewer) up to 40% of the training rows; unset, 5% capped at 1,000. Preflight returns the exact range. Do not send with eval_split_ratio."),
860
862
  precision: z.enum(["bf16", "fp8"]).optional()
@@ -959,7 +961,7 @@ END TO END: create ONE pipeline per use case; send the app's conversations with
959
961
  /* ══════════════════════════════════════════════════════════════════════════ */
960
962
  server.tool("get_platform_guide", launchGates.training || launchGates.datasets
961
963
  ? "Get a comprehensive guide to the Run BiOS platform. Call this FIRST to understand the available capabilities, the correct workflow order, supported models, GPU tiers, and best practices for serving models."
962
- : "Get a comprehensive guide explaining how to use the Run BiOS fine-tuning platform. Call this FIRST to understand the available capabilities, the correct workflow order, supported models, training methods, dataset formats, and best practices. This gives you all the context needed to help users fine-tune models effectively.", {
964
+ : "Read workflow instructions for planning training, preparing datasets and serving a model on Run BiOS. Use the guide when the user needs to understand a workflow or its prerequisites. Use the relevant list, status or preflight tool for current workspace resources, progress or cost estimates. Reading the guide starts no job.", {
963
965
  topic: z
964
966
  .enum([
965
967
  "overview",
@@ -1012,7 +1014,7 @@ ${names.map((name) => `- ${name}`).join("\n")}
1012
1014
 
1013
1015
  ${gatedSurfaces.join(" and ")} ${gatedSurfaces.length > 1 ? "are" : "is"} not available in this build yet — the creation tools are not registered, so no tool call (and no workaround) can start one today. Do not retry or search for one.
1014
1016
 
1015
- What still works: every read and lifecycle tool for existing datasets and training jobs (list_datasets, get_dataset_status, preview_dataset, update_dataset_column_mapping, revalidate_dataset, update_dataset_source, set_dataset_integration, delete_dataset, list_training_jobs, get_training_status, get_training_metrics, get_training_logs, get_training_evals, stop_training_job, resume_training_job, get_training_checkpoints, get_checkpoint_download_manifest, delete_training_checkpoint), and the full inference surface (preflight_inference, create_inference, get_inference_status, chat_with_inference, message_with_inference, complete_with_inference, embed_with_inference, rerank_with_inference).`;
1017
+ What still works: every read and lifecycle tool for existing datasets and training jobs (list_datasets, get_dataset_status, preview_dataset, update_dataset_column_mapping, revalidate_dataset, update_dataset_source, set_dataset_integration, delete_dataset, list_training_jobs, get_training_status, get_training_metrics, get_training_logs, get_training_evals, stop_training_job, resume_training_job, get_training_checkpoints, save_training_checkpoint, get_checkpoint_download_manifest, delete_training_checkpoint), and the full inference surface (preflight_inference, create_inference, get_inference_status, chat_with_inference, message_with_inference, complete_with_inference, embed_with_inference, rerank_with_inference).`;
1016
1018
  const gatedOverview = `# Run BiOS Platform
1017
1019
 
1018
1020
  Run BiOS has TWO inference products. Choosing the right one is step zero; they are not two names for the same operation.
@@ -1027,7 +1029,7 @@ Use this by default for published Run BiOS model ids. There is no GPU selection,
1027
1029
 
1028
1030
  ## Dedicated deployment — reserved GPU, durable endpoint
1029
1031
  Choose this for dedicated capacity, custom/trained checkpoints, or a durable endpoint under your control. It creates a paid resource and bills GPU time per second.
1030
- 1. **Find a source** — search_models/list_models for a catalog base model, or get_training_checkpoints for a verified trained checkpoint.
1032
+ 1. **Find a source** — search_models/list_models for a catalog base model, or get_training_checkpoints for a completed trained checkpoint.
1031
1033
  2. **Check identity and money** — introspect_api_key and get_wallet_balance. Never invent another org/workspace.
1032
1034
  3. **Check GPU fit and price** — get_inference_gpu_options.
1033
1035
  4. **Preflight** — preflight_inference validates the exact request with no wallet, queue, database, or GPU side effects. Read canonical_request, alternatives, queue_required and billing from the response.
@@ -1043,7 +1045,7 @@ ${gatedSurfaces.join(" and ")} ${gatedSurfaces.length > 1 ? "launch" : "launches
1043
1045
  ## What the PLATFORM decides for you (do not try to set these)
1044
1046
  Serving settings are derived from the model itself and are immutable. They are
1045
1047
  NOT tool inputs, and attempting to choose one is rejected:
1046
- - **Serving mode** (full / adapter / merged) comes from the verified checkpoint's
1048
+ - **Serving mode** (full / adapter / merged) comes from the checkpoint's
1047
1049
  lineage; a catalog base model is always served whole.
1048
1050
  - **OpenAI task** comes from the resolved model: an instruct/chat model and a
1049
1051
  vision-language model serve as chat, a base model with no chat template serves
@@ -1061,7 +1063,7 @@ get_inference_status instead of asserting them.
1061
1063
  ## Billing
1062
1064
  - Per-second GPU billing (NOT hourly) — you only pay for actual compute time
1063
1065
  - Wallet-based prepaid system with auto top-up option
1064
- - New accounts get a $1 welcome credit — enough to try inference, not to fund a deployment
1066
+ - New accounts start with an empty wallet: add credits in Billing before inference or a deployment
1065
1067
  - First top-up earns a deposit match: 50% within 24h of signup, 30% to 48h, 10% to 72h (deposits of $10+, bonus capped at $100)
1066
1068
 
1067
1069
  ## Authentication
@@ -1083,7 +1085,7 @@ get_inference_status instead of asserting them.
1083
1085
  11. preflight_training_job - Validate a proposed job payload (no side effects)
1084
1086
  12. list_training_jobs / get_training_status - Monitor existing jobs
1085
1087
  13. get_training_metrics / get_training_evals / get_training_logs - Loss curves, benchmarks, logs
1086
- 14. stop_training_job / resume_training_job - Control existing jobs
1088
+ 14. stop_training_job / resume_training_job / save_training_checkpoint - Control existing jobs; save the current step on request
1087
1089
  15. get_training_checkpoints / get_checkpoint_download_manifest / delete_training_checkpoint - Checkpoint access
1088
1090
 
1089
1091
  ## Inference MCP Tools
@@ -1099,7 +1101,7 @@ get_inference_status instead of asserting them.
1099
1101
  10. stop_inference / resume_inference / restart_inference - Control serving lifecycle
1100
1102
  11. chat_with_inference / message_with_inference - Call a compatible serverless catalog model or dedicated deployment; chat aggregates SSE, Messages returns ordered task events
1101
1103
  12. complete_with_inference / embed_with_inference / rerank_with_inference - Dedicated deployments only, and only when the model advertises that task; completions can return bounded ordered SSE events
1102
- 13. delete_inference - Permanently remove a deployment after verified infrastructure teardown
1104
+ 13. delete_inference - Permanently remove a deployment after its infrastructure is torn down
1103
1105
 
1104
1106
  ## Serverless Workspace Observability (analytics:read)
1105
1107
  - get_serverless_limits - Read saved workspace RPM and monthly spend cap; the org's tier may clamp effective admission further
@@ -1118,18 +1120,18 @@ Run BiOS provides serverless inference, dedicated GPU deployments, datasets, and
1118
1120
  ## Choose the workflow before calling tools
1119
1121
  - **Need an answer now from a published serverless model?** Use serverless inference: model id + chat_with_inference. No GPU booking or deployment object; billed per token.
1120
1122
  - **Need dedicated capacity or a durable endpoint?** Use dedicated deployment: GPU options -> preflight -> explicit approval -> create -> wait for running -> chat -> stop/delete. Billed per second of GPU time.
1121
- - **Need custom weights?** Prepare a dataset -> preflight and run training -> monitor -> select a verified checkpoint -> deploy that checkpoint through the dedicated workflow.${launchGates.loop ? "" : `
1123
+ - **Need custom weights?** Prepare a dataset -> preflight and run training -> monitor -> select a completed checkpoint -> deploy that checkpoint through the dedicated workflow.${launchGates.loop ? "" : `
1122
1124
  - **Need continuous improvement from real conversations?** Use the Conscious Loop workflow; capture is opt-in and automated model calls spend through the workspace's own serverless account.`}
1123
1125
 
1124
1126
  ## Training Workflow
1125
1127
  1. **Upload/import a dataset** — use upload_dataset for a local JSONL file or import_huggingface_dataset for a Hub source. Poll get_dataset_status until ready, then preview_dataset before training. A created row is not proof that processing succeeded.
1126
- 2. **Choose a base model** — Search the hosted Run BiOS catalog (search_models / list_models); every listed model is verified end-to-end and these are the only models that can be trained or deployed
1128
+ 2. **Choose a base model** — Search the hosted Run BiOS catalog (search_models / list_models); every listed model is fully supported and these are the only models that can be trained or deployed
1127
1129
  3. **Pick a training method** — SFT for instruction tuning (including vision-language models), CPT for continued pre-training on raw domain text
1128
1130
  4. **Select adapter** — LoRA (fast, efficient), QLoRA (lower VRAM), or Full fine-tune (max quality)
1129
1131
  5. **Configure hyperparameters** — learning rate, batch size, epochs, LoRA rank, etc. Smart defaults provided.
1130
1132
  6. **Nothing to choose for resources** — the platform provides and sizes the training resources. Do not ask the customer about GPUs.
1131
1133
  7. **Launch and monitor** — create_training_job only after preflight and explicit spend approval. Poll get_training_status; read metrics, evals and logs instead of inferring progress from elapsed time. Stop/resume only when available actions permit it.
1132
- 8. **Select a checkpoint** — get_training_checkpoints; use a verified/succeeded checkpoint. A running job or incomplete checkpoint is not deployable. For a job trained with start_from, deploy its checkpoint whose format is merged: its own adapters are refused with 400 CHAINED_ADAPTER_NOT_DEPLOYABLE.
1134
+ 8. **Select a checkpoint** — get_training_checkpoints; use a succeeded checkpoint. A running job or incomplete checkpoint is not deployable. For a job trained with start_from, deploy its checkpoint whose format is merged: its own adapters are refused with 400 CHAINED_ADAPTER_NOT_DEPLOYABLE.
1133
1135
  9. **Deploy the trained model** — preflight_inference with source_type=checkpoint, source_job_id and source_checkpoint_id, approve GPU/cost, then create_inference. Serving mode and base-model lineage are derived; do not guess them.
1134
1136
  10. **Wait, infer, observe** — poll get_inference_status until running, call chat_with_inference, inspect metrics/notifications, then stop or delete when explicitly requested.
1135
1137
  11. **Clean up safely** — delete_training_checkpoint or delete_dataset only after confirming it is no longer needed. Deleting source data/checkpoints is irreversible and is never implied by stopping training or deleting a deployment.
@@ -1142,7 +1144,7 @@ Run BiOS provides serverless inference, dedicated GPU deployments, datasets, and
1142
1144
  ## What the PLATFORM decides for you (do not try to set these)
1143
1145
  Serving settings are derived from the model itself and are immutable. They are
1144
1146
  NOT tool inputs, and attempting to choose one is rejected:
1145
- - **Serving mode** (full / adapter / merged) comes from the verified checkpoint's
1147
+ - **Serving mode** (full / adapter / merged) comes from the checkpoint's
1146
1148
  lineage; a catalog base model is always served whole.
1147
1149
  - **OpenAI task** comes from the resolved model: an instruct/chat model and a
1148
1150
  vision-language model serve as chat, a base model with no chat template serves
@@ -1160,7 +1162,7 @@ get_inference_status instead of asserting them.
1160
1162
  ## Billing
1161
1163
  - Per-second GPU billing (NOT hourly) — you only pay for actual compute time
1162
1164
  - Wallet-based prepaid system with auto top-up option
1163
- - New accounts get a $1 welcome credit — enough to try inference, not to fund a deployment
1165
+ - New accounts start with an empty wallet: add credits in Billing before inference or a deployment
1164
1166
  - First top-up earns a deposit match: 50% within 24h of signup, 30% to 48h, 10% to 72h (deposits of $10+, bonus capped at $100)
1165
1167
 
1166
1168
  ## Authentication
@@ -1192,7 +1194,7 @@ get_inference_status instead of asserting them.
1192
1194
  18. get_training_metrics - View loss curves and eval results
1193
1195
  19. get_training_evals - Review benchmark scores and quality assessments
1194
1196
  20. get_training_logs - Read training output logs
1195
- 21. stop_training_job / resume_training_job - Control running jobs
1197
+ 21. stop_training_job / resume_training_job / save_training_checkpoint - Control running jobs; save the current step on request
1196
1198
  22. get_training_checkpoints - Access saved model checkpoints
1197
1199
  23. get_checkpoint_download_manifest - Per-file download URLs for a checkpoint (only where model weight downloads are enabled for the workspace)
1198
1200
  24. delete_training_checkpoint - Remove a checkpoint you no longer need
@@ -1210,7 +1212,7 @@ get_inference_status instead of asserting them.
1210
1212
  10. stop_inference / resume_inference / restart_inference - Control serving lifecycle
1211
1213
  11. chat_with_inference / message_with_inference - Call a compatible serverless catalog model or dedicated deployment; chat aggregates SSE, Messages returns ordered task events
1212
1214
  12. complete_with_inference / embed_with_inference / rerank_with_inference - Dedicated deployments only, and only when the model advertises that task; completions can return bounded ordered SSE events
1213
- 13. delete_inference - Permanently remove a deployment after verified infrastructure teardown
1215
+ 13. delete_inference - Permanently remove a deployment after its infrastructure is torn down
1214
1216
 
1215
1217
  ## Serverless Workspace Observability (analytics:read)
1216
1218
  - get_serverless_limits - Read saved workspace RPM and monthly spend cap; the org's tier may clamp effective admission further
@@ -1259,7 +1261,7 @@ If a started job loses its training resources it rests at 'interrupted' (nothing
1259
1261
  models: `# Model Catalog
1260
1262
 
1261
1263
  Run BiOS serves a curated catalog of models hosted in its own storage — every
1262
- listed model is verified end-to-end for training and serving, and these are
1264
+ listed model is supported for training and serving, and these are
1263
1265
  the ONLY models that can be trained or deployed. The catalog is the source of
1264
1266
  truth: call list_models for everything currently hosted, or search_models to
1265
1267
  filter by name, provider, or size. A model that is not in the catalog is not
@@ -1269,7 +1271,7 @@ list_models and search_models read the same registry, so either one answers.
1269
1271
  If BOTH are unavailable, do not guess an id: any id already returned by
1270
1272
  list_inferences or list_training_jobs is known-hosted, the same catalog is on
1271
1273
  the Models page of the console, and reporting the catalog as unavailable is the
1272
- correct answer. An unverified id fails the create gate anyway.
1274
+ correct answer. An unlisted id fails the create gate anyway.
1273
1275
 
1274
1276
  For models this credential can INVOKE, call list_inference_models and then
1275
1277
  get_inference_model on an id it returned. Those /v1 reads include serverless
@@ -1354,7 +1356,7 @@ When to use: Before SFT, when your domain has specialized vocabulary/knowledge.
1354
1356
  ## Current limits
1355
1357
  - The current tools expose SFT and text-corpus CPT with full, LoRA and QLoRA; read get_training_capabilities for deployment-specific restrictions.
1356
1358
  - A VLM architecture does not imply support for image-only pretraining or multimodal preference objectives.
1357
- - DPO, PPO and GRPO are not enabled by these training tools. They require separately verified training implementations; PPO/GRPO also require rollout inference and reward handling.
1359
+ - DPO, PPO and GRPO are not enabled by these training tools. PPO/GRPO also require rollout inference and reward handling.
1358
1360
  - Training starts from catalog models. Do not promise a CPT-to-SFT pipeline using a customer's trained checkpoint as a new training source: that workflow is not exposed here.`,
1359
1361
  gpu_selection: `# Machines (managed training)
1360
1362
 
@@ -1407,14 +1409,14 @@ A dedicated deployment reserves GPU capacity and creates a durable endpoint. Use
1407
1409
 
1408
1410
  Capacity errors include bookable alternatives. Never silently substitute a GPU or raise a price cap. A 503 is transient and is not proof that capacity is unavailable.`,
1409
1411
  trained_model_deployment: launchGates.training
1410
- ? `# Deploying a Trained Model\n\nTraining creation is not available in this deployment. Existing verified checkpoints can still be read with get_training_checkpoints and deployed through the dedicated workflow when the key has access. Do not claim a running job or incomplete checkpoint is deployable.`
1412
+ ? `# Deploying a Trained Model\n\nTraining creation is not available in this deployment. Existing completed checkpoints can still be read with get_training_checkpoints and deployed through the dedicated workflow when the key has access. Do not claim a running job or incomplete checkpoint is deployable.`
1411
1413
  : `# Train, Deploy, and Infer a Custom Model
1412
1414
 
1413
1415
  1. Prepare data with upload_dataset or import_huggingface_dataset. Poll get_dataset_status until ready and preview_dataset to verify the actual rows/format.
1414
1416
  2. Choose a catalog base model; call get_training_capabilities, get_model_config, get_recommended_gpu/recommend_training_config, then preflight_training_job.
1415
1417
  3. State method, adapter, GPU/count, dataset sampling, maximum hourly price and estimated bound; obtain explicit spend approval.
1416
1418
  4. create_training_job. Poll get_training_status and read metrics, evals and logs. Do not translate elapsed time into progress or success.
1417
- 5. After success, call get_training_checkpoints and select a verified checkpoint. For a job trained with start_from, select its checkpoint whose format is merged: its own adapters are refused with 400 CHAINED_ADAPTER_NOT_DEPLOYABLE.
1419
+ 5. After success, call get_training_checkpoints and select a completed checkpoint. For a job trained with start_from, select its checkpoint whose format is merged: its own adapters are refused with 400 CHAINED_ADAPTER_NOT_DEPLOYABLE.
1418
1420
  6. Call preflight_inference with source_type=checkpoint, source_job_id and source_checkpoint_id. Serving mode/base lineage are derived from the checkpoint; do not invent them.
1419
1421
  7. Obtain deployment spend approval, create_inference, poll until running, then chat_with_inference.
1420
1422
  8. Observe metrics/notifications and clean up only on explicit request. Deleting the deployment does not delete the checkpoint or dataset; each destructive operation is separate and irreversible.`,
@@ -1433,7 +1435,7 @@ Every MCP tool acts inside the API key's bound organization and workspace.
1433
1435
  1. Identity: introspect_api_key and get_wallet_balance.
1434
1436
  2. Data: upload/import -> get_dataset_status until ready -> preview_dataset.
1435
1437
  3. Plan training: catalog model -> capabilities -> managed training options -> preflight_training_job.
1436
- 4. Consent and train: explicit spend approval -> create_training_job -> status/metrics/evals/logs -> verified checkpoint.
1438
+ 4. Consent and train: explicit spend approval -> create_training_job -> status/metrics/evals/logs -> completed checkpoint.
1437
1439
  5. Deploy checkpoint: preflight_inference(source_type=checkpoint) -> explicit deployment approval -> create_inference -> status=running.
1438
1440
  6. Infer: chat_with_inference -> metrics/notifications.
1439
1441
  ${launchGates.loop ? "" : "7. Improve: optional Conscious Loop capture, feedback and pipelines; capture and spending are separate opt-ins.\n"}${launchGates.loop ? 7 : 8}. Clean up: stop/delete deployment, checkpoint or dataset only as separate explicit irreversible actions.
@@ -1443,12 +1445,12 @@ At every step use returned ids and available_actions. Never infer the next actio
1443
1445
 
1444
1446
  Run BiOS has two inference products. Use serverless_inference for immediate per-token calls with no deployment, and dedicated_deployment for reserved GPU capacity or trained checkpoints.
1445
1447
 
1446
- Dedicated deployments serve either a verified fine-tuning checkpoint or a base model from the catalog through an OpenAI-compatible endpoint.
1448
+ Dedicated deployments serve either a completed fine-tuning checkpoint or a base model from the catalog through an OpenAI-compatible endpoint.
1447
1449
 
1448
1450
  ## Settings the platform derives (not tool inputs)
1449
1451
  serving_mode, model_task and supports_images are SERVER-DERIVED and immutable,
1450
1452
  so preflight_inference/create_inference do not accept them:
1451
- - serving_mode (full / adapter / merged) follows the verified checkpoint's
1453
+ - serving_mode (full / adapter / merged) follows the checkpoint's
1452
1454
  lineage; a catalog base model is served whole.
1453
1455
  - model_task follows the resolved model — chat for an instruct or
1454
1456
  vision-language model, completion for a base model with no chat template,
@@ -1611,7 +1613,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
1611
1613
  /* ══════════════════════════════════════════════════════════════════════════ */
1612
1614
  /* TOOL: introspect_api_key */
1613
1615
  /* ══════════════════════════════════════════════════════════════════════════ */
1614
- server.tool("introspect_api_key", "Discover what this API key can do. Returns the key's permissions (scopes), the org and workspace it's bound to, allowed MCP tools and SDK methods, rate limits, and expiration. Call this first to understand your access level and available capabilities.", {}, async () => {
1616
+ server.tool("introspect_api_key", "Discover what this API key can do. Returns the key's permissions (scopes), the org and workspace it's bound to, allowed MCP tools and SDK methods, rate limits, and expiration. Use it to diagnose missing access or verify which workspace the current credential represents. The signed connection supplies the credential.", {}, async () => {
1615
1617
  const data = await client.api("/api/api-keys/introspect");
1616
1618
  // Where the loop is gated, IAM's loop tools and descriptions are removed:
1617
1619
  // the answer must not advertise what tools/list hides (src/config.ts).
@@ -1628,8 +1630,8 @@ create (1-5 choices), and the queue itself stays opt-in.`,
1628
1630
  /* TOOL: search_models */
1629
1631
  /* ══════════════════════════════════════════════════════════════════════════ */
1630
1632
  server.tool("search_models", launchGates.training
1631
- ? "Search the Run BiOS model catalog — the platform's own hosted, verified models. These are the ONLY models that can be deployed on Run BiOS; a model that is not listed is not hosted yet (ask an admin to mirror it). Filter by name, provider, or parameter count. Returns model id, author, parameter counts, architecture, and downloads/likes for each result."
1632
- : "Search the Run BiOS model catalog — the platform's own hosted, verified models. These are the ONLY models that can be fine-tuned or deployed on Run BiOS; a model that is not listed is not hosted yet (ask an admin to mirror it). Filter by name, provider, or parameter count. Returns model id, author, parameter counts, architecture, and downloads/likes for each result.", {
1633
+ ? "Search the Run BiOS model catalog — the platform's own hosted models. These are the ONLY models that can be deployed on Run BiOS; a model that is not listed is not hosted yet (ask an admin to mirror it). Filter by name, provider, or parameter count. Returns model id, author, parameter counts, architecture, and downloads/likes for each result."
1634
+ : "Search the Run BiOS model catalog — the platform's own hosted models. These are the ONLY models that can be fine-tuned or deployed on Run BiOS; a model that is not listed is not hosted yet (ask an admin to mirror it). Filter by name, provider, or parameter count. Returns model id, author, parameter counts, architecture, and downloads/likes for each result.", {
1633
1635
  query: z.string().optional().describe("Search by model name (e.g., 'llama', 'mistral', 'phi', 'qwen')"),
1634
1636
  provider: z.string().optional().describe("Filter by provider/author (e.g., 'meta-llama', 'mistralai', 'microsoft', 'Qwen')"),
1635
1637
  max_params: z.string().optional().describe("Maximum parameter count (e.g., '7B', '13B', '70B')"),
@@ -1647,8 +1649,8 @@ create (1-5 choices), and the queue itself stays opt-in.`,
1647
1649
  /* TOOL: list_models */
1648
1650
  /* ══════════════════════════════════════════════════════════════════════════ */
1649
1651
  server.tool("list_models", launchGates.training
1650
- ? "List every model hosted on Run BiOS — the platform's own verified registry, mirrored in Run BiOS storage (never a live Hugging Face listing). These are the only models that can be deployed. Call this before create_inference to pick a valid model id; use search_models to filter the same catalog by text."
1651
- : "List every model hosted on Run BiOS — the platform's own verified registry, mirrored in Run BiOS storage (never a live Hugging Face listing). These are the only models that can be fine-tuned or deployed. Call this before create_training_job or create_inference to pick a valid model id; use search_models to filter the same catalog by text.", {
1652
+ ? "List every model hosted on Run BiOS — the platform's own registry, mirrored in Run BiOS storage (never a live Hugging Face listing). These are the only models that can be deployed. Call this before create_inference to pick a valid model id; use search_models to filter the same catalog by text."
1653
+ : "List every model hosted on Run BiOS — the platform's own registry, mirrored in Run BiOS storage (never a live Hugging Face listing). These are the only models that can be fine-tuned or deployed. Call this before create_training_job or create_inference to pick a valid model id; use search_models to filter the same catalog by text.", {
1652
1654
  type: z.enum(["all", "llm", "vlm"]).optional().describe("Filter by model surface (default: all)."),
1653
1655
  sort: z.enum(["downloads", "likes", "trending", "name"]).optional().describe("Sort order (default: downloads)."),
1654
1656
  limit: z.number().int().min(1).max(60).optional().describe("Page size (default 24, max 60)."),
@@ -1666,7 +1668,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
1666
1668
  });
1667
1669
  return json(withNextOffset(data, "models", pageSize, skip));
1668
1670
  });
1669
- server.tool("list_inference_models", "List models this credential can invoke through /v1/models: serverless pool models with serverless scope and this workspace's dedicated deployments with deployments:read or deployments:write. Serverless ids are maker/name (anthropic/claude-opus-5) and each carries maker {id, name}: who made it, never who serves it; prefer same-maker models when suggesting an alternative. An unreachable source is named in usf_unreachable_sources; never infer it has no models. list_models is the separate trainable-model registry.", {
1671
+ server.tool("list_inference_models", "List models this credential can invoke through /v1/models: serverless pool models with serverless scope and this workspace's dedicated deployments with deployments:read or deployments:write. Serverless ids are maker/name (anthropic/claude-opus-5) and each carries maker {id, name}: who made it, never who serves it; prefer same-maker models when suggesting an alternative. A model carrying data_retention keeps prompts and outputs for up to data_retention.days days after answering: show the user its notice before sending their content to it, and offer a model without one when they need nothing kept. An unreachable source is named in usf_unreachable_sources; never infer it has no models. list_models is the separate trainable-model registry.", {
1670
1672
  query: z.string().min(1).max(200).optional().describe("Case-insensitive match on the model id, display name, or maker (e.g. anthropic, Moonshot AI)."),
1671
1673
  limit: z.number().int().min(1).max(200).optional().describe("Models per page (default 50, maximum 200)."),
1672
1674
  offset: z.number().int().min(0).optional().describe("Models to skip; use next_offset from the previous page."),
@@ -1807,7 +1809,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
1807
1809
  /* ══════════════════════════════════════════════════════════════════════════ */
1808
1810
  /* TOOL: get_recommended_gpu */
1809
1811
  /* ══════════════════════════════════════════════════════════════════════════ */
1810
- server.tool("get_recommended_gpu", "Get authoritative, model-aware GPU options from the training control plane. Returns required counts, live availability, total hourly prices, the cheapest currently bookable recommendation, and compatible alternatives when no GPU is available. An option's host_ram_gb is the conservative per-GPU host-RAM lower bound; min_host_ram_gb is the total minimum requested from the provider. Generic GPU stock does not prove high-RAM stock: when bookable=false for a compatible option, queue that exact shape unbilled rather than recommending another unverified GPU. Pass effective_batch (samples per optimizer step -- the quality decision, 64 is standard) and max_length, and every option also carries the per-device split that runs it there: recommended_micro_batch x recommended_grad_accum x required_count. Use that split as per_device_train_batch_size / gradient_accumulation_steps when creating the job. It does not invent a duration or total-cost estimate. If method_unavailable or adapter_unavailable is true, this method and adapter have no verified offer: do not queue or create. The model_support.admissible_method_adapters map lists the method-specific adapter evidence; a declared capability alone is not proof of a completed run.", {
1812
+ server.tool("get_recommended_gpu", "Get authoritative, model-aware GPU options from the training control plane. Returns required counts, live availability, total hourly prices, the cheapest currently bookable recommendation, and compatible alternatives when no GPU is available. An option's host_ram_gb is the conservative per-GPU host-RAM lower bound; min_host_ram_gb is the total minimum requested from the provider. Generic GPU stock does not prove high-RAM stock: when bookable=false for a compatible option, queue that exact shape unbilled rather than recommending another GPU. Pass effective_batch (samples per optimizer step -- the quality decision, 64 is standard) and max_length, and every option also carries the per-device split that runs it there: recommended_micro_batch x recommended_grad_accum x required_count. Use that split as per_device_train_batch_size / gradient_accumulation_steps when creating the job. It does not invent a duration or total-cost estimate. If method_unavailable or adapter_unavailable is true, this method and adapter are not available for this model: do not queue or create. model_support.available_methods lists, per method, the adapters that can be booked.", {
1811
1813
  model: z.string().describe("Full model name (e.g., 'meta-llama/Llama-3.1-8B-Instruct')"),
1812
1814
  model_revision: z.string().optional().describe("Pinned model commit, branch or tag; the answer returns the exact immutable revision."),
1813
1815
  integration_id: z.string().optional().describe("Connected Hugging Face integration for gated model sizing."),
@@ -1841,9 +1843,9 @@ create (1-5 choices), and the queue itself stays opt-in.`,
1841
1843
  num_train_epochs: z.number().positive().optional().describe("Epochs, for the wall-clock estimate."),
1842
1844
  max_steps: z.number().int().positive().optional().describe("Step cap, if you set one."),
1843
1845
  per_device_train_batch_size: z.number().int().min(1).optional().describe("Your intended per-device batch; judged against the model."),
1844
- gradient_accumulation_steps: z.number().int().min(1).optional(),
1846
+ gradient_accumulation_steps: z.number().int().min(1).optional().describe("Number of microbatches accumulated before an optimizer update, for the configuration estimate."),
1845
1847
  dataset_ids: z.array(z.string()).max(20).optional().describe("Datasets the job will train on; their measured token statistics feed the sizing."),
1846
- model_revision: z.string().optional(),
1848
+ model_revision: z.string().optional().describe("Branch, tag or commit of the catalog model being sized. Omit to use its default revision."),
1847
1849
  integration_id: z.string().optional().describe("Connected Hugging Face integration for gated models."),
1848
1850
  }, async (params) => {
1849
1851
  const q = { model_id: params.model, gpu_type: params.gpu_type };
@@ -1885,19 +1887,19 @@ create (1-5 choices), and the queue itself stays opt-in.`,
1885
1887
  hf_integration_id: z.string().optional().describe("Legacy field kept for compatibility — catalog models are pre-mirrored and never gated, so no integration is needed."),
1886
1888
  params_b: z.number().positive().optional().describe("DEPRECATED client-fact path: total model parameters in billions; required only when model/inference_id are absent."),
1887
1889
  active_params_b: z.number().positive().optional().describe("Active MoE parameters in billions, used only for throughput hints."),
1888
- is_moe: z.boolean().optional(),
1890
+ is_moe: z.boolean().optional().describe("Whether the model uses a mixture of experts. Use catalog architecture metadata for sizing."),
1889
1891
  is_multimodal: z.boolean().optional().describe("Vision tower present (client-fact path only): reserves extra VRAM and can raise minimums. Model-addressed sizing detects this automatically."),
1890
1892
  quant: quantSchema("Precision to size the weights and KV cache for."),
1891
1893
  context_length: contextLengthSchema("Context window to size the KV cache for."),
1892
- kv_heads: z.number().int().positive().optional(),
1893
- num_layers: z.number().int().positive().optional(),
1894
- kv_layers: z.number().int().positive().optional(),
1895
- head_dim: z.number().int().positive().optional(),
1896
- attention: z.enum(["gqa", "mla"]).optional(),
1897
- num_attention_heads: z.number().int().positive().optional(),
1898
- kv_lora_rank: z.number().int().positive().optional(),
1899
- qk_rope_head_dim: z.number().int().positive().optional(),
1900
- gpu_tier: z.enum(DEPLOYMENT_GPU_TIERS).optional(),
1894
+ kv_heads: z.number().int().positive().optional().describe("Key/value head count from the model architecture, used to estimate cache memory."),
1895
+ num_layers: z.number().int().positive().optional().describe("Total model layer count used for the memory estimate."),
1896
+ kv_layers: z.number().int().positive().optional().describe("Number of layers that actually retain a key/value cache."),
1897
+ head_dim: z.number().int().positive().optional().describe("Dimension of one attention head in the model configuration."),
1898
+ attention: z.enum(["gqa", "mla"]).optional().describe("Attention architecture used in the cache calculation. Copy the model's grouped-query or latent-attention setting."),
1899
+ num_attention_heads: z.number().int().positive().optional().describe("Total number of query attention heads in the model configuration."),
1900
+ kv_lora_rank: z.number().int().positive().optional().describe("Compressed key/value latent dimension for an MLA model."),
1901
+ qk_rope_head_dim: z.number().int().positive().optional().describe("Rotary positional dimension per query/key head for an MLA model."),
1902
+ gpu_tier: z.enum(DEPLOYMENT_GPU_TIERS).optional().describe("Limit the sizing results to the selected placement tier."),
1901
1903
  }, async (params) => {
1902
1904
  // Gate the model against the Run BiOS catalog FIRST. Without it the control
1903
1905
  // plane answers a sizing miss with its upstream mirror's 404 text, which
@@ -1921,7 +1923,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
1921
1923
  /* ══════════════════════════════════════════════════════════════════════════ */
1922
1924
  /* TOOL: preflight_inference */
1923
1925
  /* ══════════════════════════════════════════════════════════════════════════ */
1924
- server.tool("preflight_inference", "Validate and canonicalize a deployment without creating a database row, authorizing funds, entering a queue, or allocating a GPU. Returns verified model facts, selected price/stock, compatible alternatives, queue requirements, a request hash, and two-hour wallet-authorization terms. The response is also where you READ the derived serving settings: serving_mode, model_task, supports_images and the resolved context_length are chosen by the platform from the model and checkpoint lineage and cannot be set as inputs. Review this result with the user before create_inference.", deploymentCreateToolSchema, async (params) => {
1926
+ server.tool("preflight_inference", "Validate and canonicalize a deployment without creating a database row, authorizing funds, entering a queue, or allocating a GPU. Returns model facts, selected price/stock, compatible alternatives, queue requirements, a request hash, and two-hour wallet-authorization terms. The response is also where you READ the derived serving settings: serving_mode, model_task, supports_images and the resolved context_length are chosen by the platform from the model and checkpoint lineage and cannot be set as inputs. Review this result with the user before create_inference.", deploymentCreateToolSchema, async (params) => {
1925
1927
  if (params.source_type === "hf_model" && params.hf_model_id) {
1926
1928
  await assertModelHosted(params.hf_model_id, "preflight_inference");
1927
1929
  }
@@ -2126,7 +2128,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2126
2128
  status: z.enum([
2127
2129
  "all", "running", "provisioning", "stopped", "failed", "queued_capacity", "degraded",
2128
2130
  "paused_insufficient_funds", "crash_loop", "downloading_weights", "loading_model",
2129
- ]).optional(),
2131
+ ]).optional().describe("Filter this workspace's deployments by lifecycle state, or choose all to include every state."),
2130
2132
  search: z.string().max(120).optional().describe("Case-insensitive deployment-name prefix."),
2131
2133
  }, async ({ limit, cursor, status, search }) => {
2132
2134
  const params = new URLSearchParams();
@@ -2194,9 +2196,9 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2194
2196
  /* ══════════════════════════════════════════════════════════════════════════ */
2195
2197
  /* TOOL: update_inference_policy */
2196
2198
  /* ══════════════════════════════════════════════════════════════════════════ */
2197
- server.tool("update_inference_policy", "Update explicit capacity-queue consent or the maximum accepted total hourly GPU price. A cap below the current verified price is rejected. This call does not silently choose another GPU.", {
2199
+ server.tool("update_inference_policy", "Update explicit capacity-queue consent or the maximum accepted total hourly GPU price. A cap below the current price is rejected. This call does not silently choose another GPU.", {
2198
2200
  deployment_id: z.string().describe("Deployment ID."),
2199
- allow_capacity_queue: z.boolean().optional(),
2201
+ allow_capacity_queue: z.boolean().optional().describe("Explicit permission to wait for capacity and provision later under the accepted price cap."),
2200
2202
  max_price_hour_cents: priceCapSchema(false),
2201
2203
  }, async ({ deployment_id, allow_capacity_queue, max_price_hour_cents }) => {
2202
2204
  validateId(deployment_id, "deployment_id");
@@ -2242,11 +2244,11 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2242
2244
  /* TOOL: list_datasets */
2243
2245
  /* ══════════════════════════════════════════════════════════════════════════ */
2244
2246
  server.tool("list_datasets", "Read one page of workspace datasets with the total count. Ready is the default; request processing, failed, or all explicitly. Pass next_offset as offset for the next page; never treat one page as the whole list. Use query to find a dataset by name. List membership does not mean the dataset is compatible with every training method.", {
2245
- query: z.string().max(256).optional(),
2246
- status: z.enum(["ready", "processing", "failed", "all"]).default("ready"),
2247
- dataset_type: z.string().max(64).optional(),
2248
- limit: z.number().int().min(1).max(200).optional(),
2249
- offset: z.number().int().min(0).optional(),
2247
+ query: z.string().max(256).optional().describe("Text to match against workspace dataset names."),
2248
+ status: z.enum(["ready", "processing", "failed", "all"]).default("ready").describe("Processing state to include. The default returns ready datasets; all includes processing and failed imports."),
2249
+ dataset_type: z.string().max(64).optional().describe("Dataset type to match, as reported for a dataset in the workspace catalog."),
2250
+ limit: z.number().int().min(1).max(200).optional().describe("Maximum number of matching records to return on this page."),
2251
+ offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
2250
2252
  }, async ({ query, status, dataset_type, limit, offset }) => {
2251
2253
  const pageSize = limit ?? 50;
2252
2254
  const skip = offset ?? 0;
@@ -2373,16 +2375,16 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2373
2375
  /* ══════════════════════════════════════════════════════════════════════════ */
2374
2376
  /* TOOL: dataset discovery and status */
2375
2377
  /* ══════════════════════════════════════════════════════════════════════════ */
2376
- server.tool("get_dataset_status", "Read dataset import/upload readiness, progress and validation failure. Do not select the dataset for training until status is ready; a dataset ID alone does not prove validation completed.", { dataset_id: z.string().min(1).max(128) }, async ({ dataset_id }) => {
2378
+ server.tool("get_dataset_status", "Read dataset import/upload readiness, progress and validation failure. Do not select the dataset for training until status is ready; a dataset ID alone does not prove validation completed.", { dataset_id: z.string().min(1).max(128).describe("Workspace dataset ID from list_datasets, including processing datasets when checking an import.") }, async ({ dataset_id }) => {
2377
2379
  validateId(dataset_id, "dataset_id");
2378
2380
  return json(await client.api(`/api/datasets/${dataset_id}/status`));
2379
2381
  });
2380
2382
  server.tool("search_huggingface_datasets", "Search a bounded page of public Hub datasets, or browse with a selected connected account. Use list_integrations to choose the account; private/gated visibility depends on its permissions. Preserve integration_id for preview and import. Public search needs datasets:read; connected browsing needs integrations:read.", {
2381
- query: z.string().max(256).optional(),
2382
- integration_id: z.string().min(1).max(128).optional(),
2383
- page: z.number().int().min(1).max(100).optional(),
2384
- limit: z.number().int().min(1).max(50).optional(),
2385
- sort: z.enum(["downloads", "likes"]).optional(),
2383
+ query: z.string().max(256).optional().describe("Text to search for in the upstream Hugging Face dataset catalog."),
2384
+ integration_id: z.string().min(1).max(128).optional().describe("Saved workspace integration ID from list_integrations for access to the source. Supply the ID, never a credential value."),
2385
+ page: z.number().int().min(1).max(100).optional().describe("One-based page of matching upstream datasets."),
2386
+ limit: z.number().int().min(1).max(50).optional().describe("Maximum number of matching records to return on this page."),
2387
+ sort: z.enum(["downloads", "likes"]).optional().describe("Rank matching repositories by download count or by likes."),
2386
2388
  }, async ({ query, integration_id, page, limit, sort }) => {
2387
2389
  if (integration_id)
2388
2390
  validateId(integration_id, "integration_id");
@@ -2394,11 +2396,11 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2394
2396
  }));
2395
2397
  });
2396
2398
  server.tool("preview_huggingface_dataset", "Preview a Hub dataset before importing. Returns available configs/subsets and splits plus sample-format validation. If configuration selection is required, repeat with one returned subset and split. Use the same integration_id as search/import; authentication failures never fall back to public access. A preview outage is not proof of valid data.", {
2397
- repo_id: z.string().min(1).max(256),
2398
- integration_id: z.string().min(1).max(128).optional(),
2399
- subset: z.string().max(256).optional(),
2400
- split: z.string().min(1).max(128).optional(),
2401
- rows: z.number().int().min(1).max(20).optional(),
2399
+ repo_id: z.string().min(1).max(256).describe("Exact dataset repository name, including its owner, from search_huggingface_datasets."),
2400
+ integration_id: z.string().min(1).max(128).optional().describe("Saved workspace integration ID from list_integrations for access to the source. Supply the ID, never a credential value."),
2401
+ subset: z.string().max(256).optional().describe("Dataset configuration to preview when the repository contains multiple subsets."),
2402
+ split: z.string().min(1).max(128).optional().describe("Named split to preview, such as train or validation, from the chosen repository and subset."),
2403
+ rows: z.number().int().min(1).max(20).optional().describe("Maximum number of sample rows to read in this preview."),
2402
2404
  }, async ({ repo_id, integration_id, subset, split, rows }) => {
2403
2405
  if (integration_id)
2404
2406
  validateId(integration_id, "integration_id");
@@ -2428,8 +2430,8 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2428
2430
  split: z.string().min(1).max(128).optional().describe("Exact selected dataset split (default: 'train')"),
2429
2431
  revision: z.string().min(1).max(256).optional().describe("Requested source commit/tag/branch; the service records an immutable commit for training and resume"),
2430
2432
  max_samples: z.number().int().positive().optional().describe("Max rows to import (imports all if omitted)"),
2431
- sample_strategy: z.enum(["first", "random"]).optional(),
2432
- import_mode: z.enum(["auto", "reference", "materialize"]).optional(),
2433
+ sample_strategy: z.enum(["first", "random"]).optional().describe("How to choose sample rows during import. Take the first rows in source order or request random sampling."),
2434
+ import_mode: z.enum(["auto", "reference", "materialize"]).optional().describe("Choose an upstream reference, a materialized copy, or let the import service decide."),
2433
2435
  name: z.string().max(255).optional().describe("Display name for the imported dataset"),
2434
2436
  }, async ({ repo_id, integration_id, subset, split, revision, max_samples, sample_strategy, import_mode, name }) => {
2435
2437
  const common = { name: name ?? repo_id.split("/").pop(), max_samples, sample_strategy, import_mode };
@@ -2450,7 +2452,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2450
2452
  /* ══════════════════════════════════════════════════════════════════════════ */
2451
2453
  /* TOOL: get_training_capabilities */
2452
2454
  /* ══════════════════════════════════════════════════════════════════════════ */
2453
- server.tool("get_training_capabilities", "Return the authoritative training contract Run BiOS enforces today: enabled and disabled methods, algorithms and adapters; exact hyperparameter names, aliases, types, defaults, enums and ranges; dependencies and incompatibilities. contract_version/schema_version identify the contract you are reading. Call this before constructing an automated training payload instead of relying on a hard-coded client list. Engine support is not per-model evidence: inspect get_recommended_gpu.model_support.admissible_method_adapters, then preflight_training_job, before offering or creating any method and adapter combination.", {}, async () => {
2455
+ server.tool("get_training_capabilities", "Return the authoritative training contract Run BiOS enforces today: enabled and disabled methods, algorithms and adapters; exact hyperparameter names, aliases, types, defaults, enums and ranges; dependencies and incompatibilities. contract_version/schema_version identify the contract you are reading. Call this before constructing an automated training payload instead of relying on a hard-coded client list. What a given model can be trained with is per model: inspect get_recommended_gpu.model_support.available_methods, then preflight_training_job, before offering or creating any method and adapter combination.", {}, async () => {
2454
2456
  const data = await client.api("/api/training/capabilities");
2455
2457
  // The contract used to carry image_compatibility — the training-engine image
2456
2458
  // VERSION range it was written against. training-service no longer emits it;
@@ -2462,7 +2464,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2462
2464
  /* ══════════════════════════════════════════════════════════════════════════ */
2463
2465
  /* TOOL: get_managed_training_options */
2464
2466
  /* ══════════════════════════════════════════════════════════════════════════ */
2465
- server.tool("get_managed_training_options", "Managed training only (get_training_capabilities lists managed_training enabled): what this model, method and adapter can be trained with. Returns options, each a precision (bf16 or fp8) and optimizer state (adamw_torch_fused = 16-bit, adamw_8bit = 8-bit) with the context lengths (2048 ... 131072) a certified setup covers. Offer the customer only these; every option listed is accepted by preflight_training_job and create_training_job. Empty options means the model is not trainable with that method and adapter yet. No hardware is named and none should be described to the customer.", {
2467
+ server.tool("get_managed_training_options", "Managed training only (get_training_capabilities lists managed_training enabled): what this model, method and adapter can be trained with. Returns options, each a precision (bf16 or fp8) and optimizer state (adamw_torch_fused = 16-bit, adamw_8bit = 8-bit) with the context lengths (2048 ... 131072) the model supports. Offer the customer only these; every option listed is accepted by preflight_training_job and create_training_job. Empty options means the model is not trainable with that method and adapter yet. No hardware is named and none should be described to the customer.", {
2466
2468
  model_id: z.string().describe("Model id, e.g. Qwen/Qwen3.5-9B."),
2467
2469
  method: z.enum(TRAINING_METHODS).optional().describe("Training method: sft (default), or pt/cpt for continued pre-training."),
2468
2470
  adapter: z.enum(TRAINING_ADAPTERS).optional().describe("lora (default), qlora or full."),
@@ -2524,14 +2526,14 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2524
2526
  dataset_id: z.string().optional().describe("Dataset id from list_datasets. An exact, unique dataset name is also accepted and resolved to its id."),
2525
2527
  dataset_ids: z.array(z.string()).min(1).max(64).optional().describe("Dataset ids (or exact, unique names) to compose for training."),
2526
2528
  eval_dataset_ids: z.array(z.string()).min(1).max(64).optional().describe("Separate evaluation datasets, composed sequentially. Mutually exclusive with eval_split_ratio."),
2527
- method: z.enum(TRAINING_METHODS),
2528
- adapter: z.enum(TRAINING_ADAPTERS).optional(),
2529
- integration_id: z.string().optional(),
2530
- dataset_mixing: z.enum(["shuffle", "sequential", "interleave"]).optional(),
2529
+ method: z.enum(TRAINING_METHODS).describe("Training objective. Use sft for supervised examples or pt/cpt for continued pretraining on a text corpus, when supported."),
2530
+ adapter: z.enum(TRAINING_ADAPTERS).optional().describe("Update all trainable weights with full, or train a low-rank adapter with lora or qlora. Check the model's supported options first."),
2531
+ integration_id: z.string().optional().describe("Saved workspace integration ID from list_integrations for access to the source. Supply the ID, never a credential value."),
2532
+ dataset_mixing: z.enum(["shuffle", "sequential", "interleave"]).optional().describe("Simple ordering strategy for multiple selected datasets. Use mixing for weighted or phased configurations."),
2531
2533
  mixing: datasetMixingSchema.optional().describe("Composition plan. Dataset IDs define source order and weight positions; default seed is 42. The source pins, plan and checksum are retained for metadata-only resume."),
2532
2534
  start_from: startFromSchema.optional(),
2533
2535
  ...trainingConfigurationSchema,
2534
- config: z.record(z.string(), z.unknown()).optional(),
2536
+ config: z.record(z.string(), z.unknown()).optional().describe("Additional training settings for the preflight validator. Prefer the named parameters and settings returned by get_training_capabilities."),
2535
2537
  }, async (params) => {
2536
2538
  await assertModelHosted(params.model, "preflight_training_job");
2537
2539
  const body = buildTrainingCreateBody(await withResolvedDatasets(params));
@@ -2562,8 +2564,8 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2562
2564
  eval_dataset_ids: z.array(z.string()).min(1).max(64).optional().describe("Separate evaluation datasets, composed sequentially. Mutually exclusive with eval_split_ratio."),
2563
2565
  method: z.enum(TRAINING_METHODS).describe("Training method: sft, or pt/cpt for continued pre-training."),
2564
2566
  adapter: z.enum(TRAINING_ADAPTERS).optional().describe("Any adapter supported by the Run BiOS contract."),
2565
- integration_id: z.string().optional(),
2566
- dataset_mixing: z.enum(["shuffle", "sequential", "interleave"]).optional(),
2567
+ integration_id: z.string().optional().describe("Saved workspace integration ID from list_integrations for access to the source. Supply the ID, never a credential value."),
2568
+ dataset_mixing: z.enum(["shuffle", "sequential", "interleave"]).optional().describe("Simple ordering strategy for multiple selected datasets. Use mixing for weighted or phased configurations."),
2567
2569
  mixing: datasetMixingSchema.optional().describe("Composition plan. Dataset IDs define source order and weight positions; default seed is 42. The source pins, plan and checksum are retained for metadata-only resume."),
2568
2570
  start_from: startFromSchema.optional(),
2569
2571
  ...trainingConfigurationSchema,
@@ -2692,9 +2694,19 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2692
2694
  return json(data);
2693
2695
  });
2694
2696
  /* ══════════════════════════════════════════════════════════════════════════ */
2697
+ /* TOOL: save_training_checkpoint */
2698
+ /* ══════════════════════════════════════════════════════════════════════════ */
2699
+ server.tool("save_training_checkpoint", "Ask a running training job to save its current step now. The trainer saves after the step it is on and uploads that checkpoint right away; it appears in get_training_checkpoints once the upload completes. Kept until the job ends, when only the best and the final checkpoint remain. Refused (409) when the job is not training.", {
2700
+ job_id: z.string().describe("Training job ID"),
2701
+ }, async ({ job_id }) => {
2702
+ validateId(job_id, "job_id");
2703
+ const data = await client.api(`/api/training/jobs/${job_id}/checkpoints/save`, { method: "POST" });
2704
+ return json(data);
2705
+ });
2706
+ /* ══════════════════════════════════════════════════════════════════════════ */
2695
2707
  /* TOOL: resume_training_job */
2696
2708
  /* ══════════════════════════════════════════════════════════════════════════ */
2697
- server.tool("resume_training_job", "Resume a stopped or 'interrupted' training job from its latest checkpoint when the server has verified it as resumable. 'interrupted' is the self-heal rest state a started job enters after losing its pod (billing already stopped, distinct from 'failed'). Resume re-books on secured capacity before reporting resumed (book-before-reveal still applies). The response identifies the job; exact optimizer/epoch continuation depends on the checkpoint manifest and is not assumed by this tool.", {
2709
+ server.tool("resume_training_job", "Resume a stopped or 'interrupted' training job from its latest checkpoint when the server reports it as resumable. 'interrupted' is the self-heal rest state a started job enters after losing its pod (billing already stopped, distinct from 'failed'). Resume re-books on secured capacity before reporting resumed (book-before-reveal still applies). The response identifies the job; exact optimizer/epoch continuation depends on the checkpoint manifest and is not assumed by this tool.", {
2698
2710
  job_id: z.string().describe("Training job ID to resume"),
2699
2711
  idempotency_key: z
2700
2712
  .string()
@@ -2750,7 +2762,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2750
2762
  /* ══════════════════════════════════════════════════════════════════════════ */
2751
2763
  /* TOOL: get_training_evals */
2752
2764
  /* ══════════════════════════════════════════════════════════════════════════ */
2753
- server.tool("get_training_evals", "Get evaluation results for a training job. Returns benchmark scores, eval metrics, and model quality assessments computed during or after training.", {
2765
+ server.tool("get_training_evals", "Read evaluation results for the selected workspace training job. Use this for benchmark scores, evaluation metrics and quality assessments computed during or after training. Use get_training_metrics for the training loss curve and get_training_status for lifecycle progress.", {
2754
2766
  job_id: z.string().describe("Training job ID"),
2755
2767
  }, async ({ job_id }) => {
2756
2768
  validateId(job_id, "job_id");
@@ -2802,9 +2814,9 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2802
2814
  })
2803
2815
  .optional()
2804
2816
  .describe(MAX_TOKENS_POLICY_TEXT),
2805
- temperature: z.number().min(0).max(2).optional(),
2806
- top_p: z.number().min(0).max(1).optional(),
2807
- response_format: z.record(z.string(), z.unknown()).optional(),
2817
+ temperature: z.number().min(0).max(2).optional().describe("Sampling temperature. Lower values make generation more deterministic when the selected model supports temperature."),
2818
+ top_p: z.number().min(0).max(1).optional().describe("Nucleus sampling probability mass for generation, when supported by the selected model."),
2819
+ response_format: z.record(z.string(), z.unknown()).optional().describe("Chat response format supported by the selected model, such as a JSON object or a structured response schema."),
2808
2820
  reasoning_effort: z
2809
2821
  .enum(["none", "minimal", "low", "medium", "high", "xhigh", "max"])
2810
2822
  .optional()
@@ -2821,7 +2833,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2821
2833
  .max(255)
2822
2834
  .optional()
2823
2835
  .describe("Stable caller-generated key to reuse only when explicitly retrying the same POST."),
2824
- request_id: z.string().min(1).max(255).optional(),
2836
+ request_id: z.string().min(1).max(255).optional().describe("Caller-supplied request identifier for tracing this inference request."),
2825
2837
  };
2826
2838
  if (inferenceSupportsTools) {
2827
2839
  server.tool("chat_with_inference", chatWithInferenceDescription, {
@@ -2834,12 +2846,12 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2834
2846
  .union([
2835
2847
  z.enum(["none", "auto", "required"]),
2836
2848
  z.object({
2837
- type: z.literal("function"),
2838
- function: z.object({ name: z.string().min(1).max(64) }),
2849
+ type: z.literal("function").describe("Selects a named function from the tool definitions supplied in this request."),
2850
+ function: z.object({ name: z.string().min(1).max(64).describe("Exact function name as declared in this request.") }).describe("The function from this request's tools that the model should call."),
2839
2851
  }),
2840
2852
  ])
2841
- .optional(),
2842
- parallel_tool_calls: z.boolean().optional(),
2853
+ .optional().describe("Let the target model select a tool automatically, forbid or require a call, or select an exact function offered in tools."),
2854
+ parallel_tool_calls: z.boolean().optional().describe("Whether the model may request multiple function calls in the same response."),
2843
2855
  }, async (input, extra) => {
2844
2856
  const body = buildInferenceBody(input);
2845
2857
  const data = await client.inferenceApi(body, input.idempotency_key, input.request_id, extra.signal);
@@ -2857,16 +2869,16 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2857
2869
  const taskControlSchema = {
2858
2870
  model: z.string().min(1).optional().describe("Serverless catalog model id, or dedicated deployment name/id. A dedicated inference key may select its deployment without a model id."),
2859
2871
  idempotency_key: z.string().min(1).max(255).optional().describe("Caller-generated key for an explicit retry of the same POST; never retried automatically."),
2860
- request_id: z.string().min(1).max(255).optional(),
2872
+ request_id: z.string().min(1).max(255).optional().describe("Caller-supplied request identifier for tracing this inference request."),
2861
2873
  };
2862
2874
  const taskStreamSchema = z.boolean().optional().describe("Consume SSE and return the ordered, unmodified events in one MCP result (maximum 2 MB or 4096 events). Defaults to false; use an SDK for longer streams.");
2863
2875
  server.tool("complete_with_inference", "Call a dedicated deployment that serves OpenAI text completions on /v1/completions. Serverless pools do not expose this route. Use a model/deployment that advertises this task. stream=true returns the ordered SSE events. Never implicitly retries a billable POST.", {
2864
2876
  ...taskControlSchema,
2865
- prompt: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]),
2877
+ prompt: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).describe("Text to complete, or a batch of input strings for the selected completion deployment."),
2866
2878
  max_tokens: z.number().int().min(1).max(CONTEXT_TOOL_MAX).optional().describe(MAX_TOKENS_POLICY_TEXT),
2867
- temperature: z.number().min(0).max(2).optional(),
2868
- top_p: z.number().min(0).max(1).optional(),
2869
- stop: z.union([z.string(), z.array(z.string())]).optional(),
2879
+ temperature: z.number().min(0).max(2).optional().describe("Sampling temperature. Lower values make generation more deterministic when the selected model supports temperature."),
2880
+ top_p: z.number().min(0).max(1).optional().describe("Nucleus sampling probability mass for generation, when supported by the selected model."),
2881
+ stop: z.union([z.string(), z.array(z.string())]).optional().describe("Stop sequences that end text generation when matched."),
2870
2882
  stream: taskStreamSchema,
2871
2883
  }, async (input, extra) => {
2872
2884
  const { idempotency_key, request_id, ...body } = input;
@@ -2874,28 +2886,28 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2874
2886
  });
2875
2887
  server.tool("embed_with_inference", "Create embeddings with a dedicated deployment that serves /v1/embeddings. The serverless pool has no embeddings route; a chat-only model cannot embed. Never implicitly retries a billable POST.", {
2876
2888
  ...taskControlSchema,
2877
- input: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]),
2889
+ input: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).describe("Text, or a batch of texts, for the selected deployment to convert into embedding vectors."),
2878
2890
  }, async (input, extra) => {
2879
2891
  const { idempotency_key, request_id, ...body } = input;
2880
2892
  return json(await client.inferenceApi(body, idempotency_key, request_id, extra.signal, "/v1/embeddings"));
2881
2893
  });
2882
2894
  server.tool("rerank_with_inference", "Rerank documents with a dedicated deployment that serves /v1/rerank. The serverless pool has no rerank route; a chat-only model cannot rerank. Never implicitly retries a billable POST.", {
2883
2895
  ...taskControlSchema,
2884
- query: z.string().min(1),
2885
- documents: z.array(z.string().min(1)).min(1),
2896
+ query: z.string().min(1).describe("Search text against which the candidate documents should be scored."),
2897
+ documents: z.array(z.string().min(1)).min(1).describe("Candidate document texts to rank against the query. Returned indices refer to this order."),
2886
2898
  }, async (input, extra) => {
2887
2899
  const { idempotency_key, request_id, ...body } = input;
2888
2900
  return json(await client.inferenceApi(body, idempotency_key, request_id, extra.signal, "/v1/rerank"));
2889
2901
  });
2890
2902
  server.tool("message_with_inference", "Call an Anthropic-compatible /v1/messages model: a capable serverless catalog model or a dedicated deployment that serves this dialect. The selected inference credential stays server-side. stream=true returns ordered Anthropic SSE events without losing tool-use deltas; never implicitly retries a billable POST.", {
2891
2903
  ...taskControlSchema,
2892
- messages: z.array(z.record(z.string(), z.unknown())).min(1),
2904
+ messages: z.array(z.record(z.string(), z.unknown())).min(1).describe("Ordered Messages API conversation turns, using the role and content fields supported by the deployment."),
2893
2905
  max_tokens: z.number().int().min(1).max(CONTEXT_TOOL_MAX).describe(MAX_TOKENS_POLICY_TEXT),
2894
- system: z.union([z.string(), z.array(z.record(z.string(), z.unknown()))]).optional(),
2895
- tools: z.array(z.record(z.string(), z.unknown())).optional(),
2896
- tool_choice: z.record(z.string(), z.unknown()).optional(),
2897
- stop_sequences: z.array(z.string()).optional(),
2898
- thinking: z.record(z.string(), z.unknown()).optional(),
2906
+ system: z.union([z.string(), z.array(z.record(z.string(), z.unknown()))]).optional().describe("System instructions for this inference request in the Messages API format accepted by the deployment."),
2907
+ tools: z.array(z.record(z.string(), z.unknown())).optional().describe("Messages API tool definitions offered to the target model for this inference request."),
2908
+ tool_choice: z.record(z.string(), z.unknown()).optional().describe("Tool selection policy for this inference request. Use a choice supported by the deployment and the tools you supplied."),
2909
+ stop_sequences: z.array(z.string()).optional().describe("Text sequences at which the deployment should stop generating."),
2910
+ thinking: z.record(z.string(), z.unknown()).optional().describe("Provider-compatible thinking configuration supported by the selected Messages API deployment."),
2899
2911
  stream: taskStreamSchema,
2900
2912
  }, async (input, extra) => {
2901
2913
  const { idempotency_key, request_id, ...body } = input;
@@ -2908,8 +2920,8 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2908
2920
  server.tool("get_serverless_usage_by_model", "Read this workspace's billed serverless usage by model, with no provider identity or prompts. Requires analytics:read.", { window: serverlessUsageWindowInput }, async ({ window }) => json(await client.serverlessRead("/api/serverless/usage/by-model", "rows", { window: window ?? "24h" })));
2909
2921
  server.tool("list_serverless_requests", "Read this workspace's bounded per-request serverless outcomes (including platform failures), without prompt/completion content or key usage details. Requires analytics:read. Raw detail is retained for about seven days.", {
2910
2922
  window: serverlessUsageWindowInput,
2911
- outcome: z.enum(["all", "ok", "failed", "rejected"]).optional(),
2912
- request_id: z.string().min(1).max(255).optional(),
2923
+ outcome: z.enum(["all", "ok", "failed", "rejected"]).optional().describe("Filter request history by success, failure or rejection, or include all outcomes."),
2924
+ request_id: z.string().min(1).max(255).optional().describe("Exact request ID to look up in this workspace's retained serverless request history."),
2913
2925
  limit: z.number().int().min(1).max(500).optional().describe("Maximum log rows (default 100, hard maximum 500)."),
2914
2926
  before: z.string().datetime({ offset: true }).optional().describe("Only rows created before this RFC 3339 time. Pass next_before from the previous page to read older rows."),
2915
2927
  }, async ({ window, outcome, request_id, limit, before }) => {
@@ -2921,11 +2933,11 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2921
2933
  const last = rows.at(-1)?.created_at;
2922
2934
  return json({ ...page, next_before: !request_id && rows.length === pageSize && typeof last === "string" ? last : null });
2923
2935
  });
2924
- server.tool("get_serverless_usage_timeseries", "Read this workspace's per-bucket serverless requests, tokens, spend or streaming latency/throughput. Requires analytics:read. Missing streaming-only buckets are null, not zero.", { window: serverlessUsageWindowInput, metric: z.enum(["requests", "tokens", "spend", "ttft_p50", "ttft_p95", "tps"]) }, async ({ window, metric }) => json(await client.serverlessRead("/api/serverless/usage/timeseries", "timeseries", {
2936
+ server.tool("get_serverless_usage_timeseries", "Read this workspace's per-bucket serverless requests, tokens, spend or streaming latency/throughput. Requires analytics:read. Missing streaming-only buckets are null, not zero.", { window: serverlessUsageWindowInput, metric: z.enum(["requests", "tokens", "spend", "ttft_p50", "ttft_p95", "tps"]).describe("Metric to aggregate per time bucket. TTFT measures time to first token and TPS measures output tokens per second.") }, async ({ window, metric }) => json(await client.serverlessRead("/api/serverless/usage/timeseries", "timeseries", {
2925
2937
  window: window ?? "24h", metric,
2926
2938
  })));
2927
2939
  server.tool("get_serverless_usage_daily", "Read this workspace's full-history admitted requests, tokens and spend alongside its per-day series from the same counters (failed admitted requests count; synthetic probes do not). Requires analytics:read. Returns the server-clamped 1–92 day range.", { days: z.number().int().min(1).max(92).optional().describe("Number of UTC days (default 30, maximum 92).") }, async ({ days }) => json(await client.serverlessRead("/api/serverless/usage/daily", "daily", { days: String(days ?? 30) })));
2928
- server.tool("get_serverless_savings", "Read what model promotions saved the signed-in key creator and their workspace, over the selected window, today, and over the retained lifetime. Requires analytics:read and current workspace access.", { window: serverlessUsageWindow.optional() }, async ({ window }) => json(await client.serverlessRead("/api/serverless/usage/savings", "savings", { window: window ?? "30d" })));
2940
+ server.tool("get_serverless_savings", "Read what model promotions saved the signed-in key creator and their workspace, over the selected window, today, and over the retained lifetime. Requires analytics:read and current workspace access.", { window: serverlessUsageWindow.optional().describe("Savings reporting period ending now. Defaults to 30d.") }, async ({ window }) => json(await client.serverlessRead("/api/serverless/usage/savings", "savings", { window: window ?? "30d" })));
2929
2941
  /* ══════════════════════════════════════════════════════════════════════════ */
2930
2942
  /* TOOLS: Conscious Loop */
2931
2943
  /* */
@@ -2986,8 +2998,8 @@ create (1-5 choices), and the queue itself stays opt-in.`,
2986
2998
  messages: z.array(z.record(z.string(), z.unknown())).min(1).describe("The conversation to send, in chat-completions shape: [{\"role\": \"user\", \"content\": \"...\"}]"),
2987
2999
  model: z.string().min(1).optional().describe("The model to ask: a serverless model id or a deployment name. Leave it out to ask the pipeline's own model, loop-<pipeline ID>, which answers with the live version. Required before the pipeline's first version: pass the model the app uses now."),
2988
3000
  max_tokens: z.number().int().min(1).max(CONTEXT_TOOL_MAX).optional().describe(MAX_TOKENS_POLICY_TEXT),
2989
- temperature: z.number().min(0).max(2).optional(),
2990
- request_id: z.string().min(1).max(255).optional(),
3001
+ temperature: z.number().min(0).max(2).optional().describe("Sampling temperature. Lower values make generation more deterministic when the selected model supports temperature."),
3002
+ request_id: z.string().min(1).max(255).optional().describe("Caller-supplied request identifier for tracing this inference request."),
2991
3003
  }, async ({ pipeline, messages, model, max_tokens, temperature, request_id }, extra) => {
2992
3004
  const id = pipeline.trim().toLowerCase();
2993
3005
  if (!LOOP_PIPELINE_ID.test(id)) {
@@ -3032,26 +3044,26 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3032
3044
  model: z.string().describe("The model that produced the answer, e.g. 'gpt-4o' or a Run BiOS model id"),
3033
3045
  messages: z.array(z.object({
3034
3046
  role: z.string().describe("system | user | assistant | tool"),
3035
- content: z.string().optional(),
3047
+ content: z.string().optional().describe("Message text from the conversation turn being captured."),
3036
3048
  tool_call_id: z.string().optional().describe("On a tool result turn, the call it answers"),
3037
3049
  name: z.string().optional().describe("On a tool result turn, the tool's name"),
3038
3050
  })).describe("The conversation as it was sent to the model"),
3039
3051
  completion: z.string().optional().describe("The assistant's answer text. Omit when the answer was purely a tool call."),
3040
3052
  tool_calls: z.array(z.object({
3041
- id: z.string().optional(),
3042
- type: z.string().optional(),
3053
+ id: z.string().optional().describe("Original tool call ID used to associate its response with this call."),
3054
+ type: z.string().optional().describe("Tool call type recorded in the original conversation, typically function."),
3043
3055
  function: z.object({
3044
- name: z.string(),
3056
+ name: z.string().describe("Exact function name recorded in the original tool call."),
3045
3057
  arguments: z.string().describe("JSON-encoded string, as the chat-completions wire format uses"),
3046
- }),
3058
+ }).describe("Name and arguments of the function requested in the captured turn."),
3047
3059
  })).optional().describe("What the answering turn invoked, if anything"),
3048
3060
  tools: z.any().optional().describe("The tool schema the model was offered. Training tool use without it teaches the model to invent function names."),
3049
3061
  conversation_id: z.string().optional().describe("Ties the turns of one conversation together"),
3050
3062
  request_id: z.string().optional().describe("Your own idempotency handle — sending the same one again will not create a second sample"),
3051
- latency_ms: z.number().int().optional(),
3063
+ latency_ms: z.number().int().optional().describe("Observed end-to-end response latency for this captured turn, in milliseconds."),
3052
3064
  labels: z.array(z.string()).max(32).optional().describe("Tags for this conversation, beside the ones its source stamps. A pipeline trains on every sample carrying any of its tags. At most 32 in all."),
3053
3065
  feedback: z.object({
3054
- verdict: z.enum(["good", "bad", "corrected"]),
3066
+ verdict: z.enum(["good", "bad", "corrected"]).describe("Review outcome for the captured answer. Use corrected when supplying a replacement answer."),
3055
3067
  correction: z.string().optional().describe("Required with corrected, and read only then: the answer that should have been given"),
3056
3068
  }).optional().describe("The feedback you already have, written with the exchange. Pass request_id too, so a retry records it once."),
3057
3069
  }, async ({ source, model, messages, completion, tool_calls, tools, conversation_id, request_id, latency_ms, labels, feedback }) => {
@@ -3086,7 +3098,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3086
3098
  source: z.string().optional().describe("Only conversations from this source"),
3087
3099
  model: z.string().optional().describe("Only what THIS model answered, e.g. 'moonshotai/kimi-k3'. The filter distillation is made of — every other filter selects by what was asked or what somebody said about the answer, never by who produced it."),
3088
3100
  origin: z.enum(["captured", "imported"]).optional().describe("captured = the workspace's own model behaviour; imported = a file somebody brought in. Pooling them makes 'train only on what we actually served' unanswerable."),
3089
- conversation_id: z.string().optional(),
3101
+ conversation_id: z.string().optional().describe("Only return samples belonging to this conversation."),
3090
3102
  pipeline: z.string().optional().describe("Only the conversations this pipeline trains on (its id, from loop_list_pipelines): its tags or its datasets, narrowed by its conditions, reviewed or not. Each sample then carries state."),
3091
3103
  dataset: z.string().optional().describe("Only the conversations one saved dataset selects (its id, from loop_list_datasets): the same samples its samples count. Not with pipeline."),
3092
3104
  attempt: z.string().optional().describe("Only the samples of one training (its run id, from loop_list_pipeline_attempts); pass split too."),
@@ -3101,7 +3113,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3101
3113
  from: z.string().datetime({ offset: true }).optional().describe("Only conversations recorded at or after this RFC 3339 time"),
3102
3114
  to: z.string().datetime({ offset: true }).optional().describe("Only conversations recorded at or before this RFC 3339 time"),
3103
3115
  limit: z.number().int().min(1).max(200).optional().describe("Default 50, maximum 200"),
3104
- offset: z.number().int().optional(),
3116
+ offset: z.number().int().optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
3105
3117
  }, async ({ q, source, model, origin, conversation_id, pipeline, dataset, attempt, split, label, attributes, unlabelled, signal, unsignalled, signalled_only, judge, from, to, limit, offset }) => {
3106
3118
  const attrs = Object.entries(attributes ?? {})
3107
3119
  .filter(([k, v]) => k && v)
@@ -3136,7 +3148,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3136
3148
  const data = await client.api(`/api/loop/traces/${encodeURIComponent(trace_id)}`);
3137
3149
  return json(data);
3138
3150
  });
3139
- server.tool("loop_delete_trace", "Delete one recorded conversation, with its feedback and tags, for good. It stops counting toward every pipeline that selected it. Where the live version of a pipeline learned from it, that pipeline rebuilds its model from the original model on every remaining sample, without it: the answer's rebuilds lists each such pipeline ({pipeline_id, pipeline_name}; empty when none) -- read them back, because a rebuild is a new training paid from the wallet. A switched-off pipeline is listed too: its rebuild starts when it is switched back on. Until the rebuild goes live the live version still holds what it learned from it; once it does, no version that learned it can be rolled back to, and their stored weights are deleted. Any other version already trained on it keeps what it learned, and a conversation that expires under the retention setting rebuilds nothing. Confirm with the user first: this cannot be undone.", { trace_id: z.string() }, async ({ trace_id }) => json(await client.api(`/api/loop/traces/${encodeURIComponent(trace_id)}`, { method: "DELETE" })));
3151
+ server.tool("loop_delete_trace", "Delete one recorded conversation, with its feedback and tags, for good. It stops counting toward every pipeline that selected it. Where the live version of a pipeline learned from it, that pipeline rebuilds its model from the original model on every remaining sample, without it: the answer's rebuilds lists each such pipeline ({pipeline_id, pipeline_name}; empty when none) -- read them back, because a rebuild is a new training paid from the wallet. A switched-off pipeline is listed too: its rebuild starts when it is switched back on. Until the rebuild goes live the live version still holds what it learned from it; once it does, no version that learned it can be rolled back to, and their stored weights are deleted. Any other version already trained on it keeps what it learned, and a conversation that expires under the retention setting rebuilds nothing. Confirm with the user first: this cannot be undone.", { trace_id: z.string().describe("ID of the saved sample returned by loop_list_traces.") }, async ({ trace_id }) => json(await client.api(`/api/loop/traces/${encodeURIComponent(trace_id)}`, { method: "DELETE" })));
3140
3152
  /**
3141
3153
  * Feedback that names a sample the gateway issued moments ago can arrive before
3142
3154
  * the sample is saved, and is refused 409 SAMPLE_NOT_YET_RECORDED with nothing
@@ -3173,11 +3185,11 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3173
3185
  }
3174
3186
  }
3175
3187
  server.tool("loop_add_signal", "Say how an answer did: Good, Wrong, or Wrong with the right answer. trace_id is the sample ID (loop_chat's sample_id, the X-Loop-Sample-Id an app got back, or a trace_id from loop_capture_trace or loop_list_traces). Feedback is added, never replaced: a second one sits beside the first, because two reviewers disagreeing is worth knowing, and the newest from a person decides.\n\nWHAT EACH ONE DOES (every version learns from examples):\n• good (stored as accepted) — the answer was right. It is learned as it is.\n• bad (stored as rejected) — it was wrong and you have nothing better. It is LEFT OUT of training and nothing is learned from it; prefer corrected whenever you know the right answer.\n• corrected (stored as edited) — the model was WRONG and here is what it should have said, in correction. The most valuable single action: your right answer is learned instead of the model's. Nothing is learned from the answer it replaced.\n• gold — the right answer for this question, recorded whatever the model happened to say. It trains exactly like corrected; it only makes no claim that the model was wrong.\nTraining that learns from rankings or rewards is not available yet, so bad with no right answer teaches nothing; a correction does.\n\nFeedback sent the instant an answer arrives can reach the platform before the conversation is saved (409 SAMPLE_NOT_YET_RECORDED, nothing recorded). This tool then waits (the Retry-After seconds, 2 when none is given, at most 30) and sends the same feedback again by itself, at most 6 tries in all. If it is still refused, the sample ID names no saved conversation yet: saving is behind, or the call named a pipeline ID no pipeline has and nothing else recorded it. Say so, and check the pipeline ID.", {
3176
- trace_id: z.string(),
3188
+ trace_id: z.string().describe("ID of the saved sample returned by loop_list_traces."),
3177
3189
  verdict: z.enum(["good", "bad", "corrected", "gold", "accepted", "rejected", "edited"]).describe("good = the answer was right; bad = it was wrong, with nothing better to offer; corrected = it was wrong and correction is the right answer; gold = the right answer for this question regardless of what the model said. accepted, rejected and edited are the stored names of good, bad and corrected, and are taken too"),
3178
3190
  correction: z.string().optional().describe("REQUIRED with 'corrected' or 'edited' (the answer it should have given) and with 'gold' (the right answer for this question)"),
3179
3191
  reason: z.string().optional().describe("Why, in your own words"),
3180
- author: z.string().optional(),
3192
+ author: z.string().optional().describe("Who supplied this feedback, as it should appear in the record."),
3181
3193
  labels: z.array(z.string()).optional().describe("Which pipeline this feedback feeds, named HERE rather than in a second call: a pipeline trains on every conversation carrying any of its tags, so a tag is the pipeline a conversation goes down. Sent with the feedback it is written in one transaction: either both land or neither does. A separate tagging call is the one that gets skipped, and what it leaves is a reviewed conversation in no pipeline — counted in every 'reviewed' total and selected by nothing."),
3182
3194
  attributes: z.record(z.string(), z.string()).optional().describe("The same, by named dimension: {\"category\": \"billing\"}."),
3183
3195
  parent: z.string().optional().describe("The master group the bare labels belong to, so selecting the group picks them up without anybody maintaining a list. Leave it out and a label the conversation already carries keeps the group it has; send an empty string to take the labels out of their group."),
@@ -3191,9 +3203,9 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3191
3203
  }), extra?.signal);
3192
3204
  return json(data);
3193
3205
  });
3194
- server.tool("loop_list_signals", "All the feedback recorded on one conversation, oldest first. Feedback is added, never replaced, so two reviewers who disagreed are both here.", { trace_id: z.string() }, async ({ trace_id }) => json(await client.api(`/api/loop/traces/${encodeURIComponent(trace_id)}/signals`)));
3206
+ server.tool("loop_list_signals", "All the feedback recorded on one conversation, oldest first. Feedback is added, never replaced, so two reviewers who disagreed are both here.", { trace_id: z.string().describe("ID of the saved sample returned by loop_list_traces.") }, async ({ trace_id }) => json(await client.api(`/api/loop/traces/${encodeURIComponent(trace_id)}/signals`)));
3195
3207
  server.tool("loop_label_trace", "Label a recorded conversation so it can be selected later. An average over everything is the least useful thing to train on — a model weak at refunds is fixed with refund examples, and you can only select those if the conversation was labelled when it arrived. A label may name a PARENT, which makes a master group: labelling something 'refunds' with parent 'billing' makes it selectable as either, and selecting 'billing' later gathers every child without anybody maintaining a list of them. Labels are lowercased and trimmed, so 'Refunds' and 'refunds' are one label.", {
3196
- trace_id: z.string(),
3208
+ trace_id: z.string().describe("ID of the saved sample returned by loop_list_traces."),
3197
3209
  labels: z.array(z.string()).optional().describe("Bare tags, e.g. ['refunds','escalated']. Lowercase letters, digits, dot, dash or underscore."),
3198
3210
  attributes: z.record(z.string(), z.string()).optional().describe("NAMED DIMENSIONS, e.g. {\"category\":\"billing\",\"task\":\"refund-handling\",\"language\":\"es\"}. This is what lets one captured corpus become a different dataset for every task somebody trains for: filters on different dimensions AND together, and a dimension is matched EXACTLY within its key, so source=support never matches team=support. Setting one dimension leaves the others untouched, so correcting a mistake needs no delete first."),
3199
3211
  parent: z.string().optional().describe("The master group the bare labels belong to, e.g. 'billing'. It applies to 'labels' only; sent with attributes and no labels it groups nothing and is refused. LEAVE IT OUT to keep whatever group a label the conversation already carries is in — re-sending 'refunds' without it does not take 'refunds' out of 'billing'. Send an empty string to take the labels out of their group; the labels themselves stay."),
@@ -3204,7 +3216,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3204
3216
  return json(data);
3205
3217
  });
3206
3218
  server.tool("loop_remove_label", "Remove one label from a conversation. The counterpart to loop_label_trace, which until now had none — an agent could label something and then had no way to correct it. 'key' names the dimension; leave it out for a bare tag, which is what a plain name has always been.", {
3207
- trace_id: z.string(),
3219
+ trace_id: z.string().describe("ID of the saved sample returned by loop_list_traces."),
3208
3220
  label: z.string().describe("The value to remove, e.g. 'refunds' or 'billing'"),
3209
3221
  key: z.string().optional().describe("The dimension it belongs to, e.g. 'category'. Omit for a bare tag."),
3210
3222
  }, async ({ trace_id, label, key }) => {
@@ -3213,7 +3225,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3213
3225
  return json(data);
3214
3226
  });
3215
3227
  server.tool("loop_list_labels", "Every label in this workspace with how many conversations carry it. Use it to see where the corpus actually is before choosing a slice to train on — and to discover the master groups, since a parent may have no conversations labelled with it directly. Two fields answer the group question and they answer different ones: 'parent' is the group ALL of a label's conversations are in, and is null the moment they disagree; 'parents' is every group ANY of them are in, each with how many of this label's conversations are in it. LIST THE MASTER GROUPS FROM 'parents' — a label with 12 conversations, 5 of them under support, reports parent null and parents [{support, 5}], so reading only 'parent' finds no group for it. Never state that a label is in a group on the strength of 'parents' alone; say how many of it are.", {}, async () => json(await client.api("/api/loop/labels")));
3216
- server.tool("loop_get_trace_pipelines", "Which pipelines one conversation feeds: every live pipeline whose tags or datasets select it (and whose conditions keep it), and whether each is switched on. Being listed means the pipeline would select it, not that it will be trained on — training still drops duplicates and answers it cannot use, and keeps some aside for the automatic test. Each pipeline's state says what happens to it there: held_back (kept aside for the automatic test, never trained on), learned (version_no learned it), trained (training attempt_no learned from it and did not become a version), waiting (for the next training) or left_out (not trained on as it is), and reason is the sentence to read back (for left_out, why). An empty list is a real answer: the conversation counts toward 'reviewed' and trains nothing, so add a pipeline's tag to it (loop_label_trace) if it should.", { trace_id: z.string() }, async ({ trace_id }) => json(await client.api(`/api/loop/traces/${encodeURIComponent(trace_id)}/pipelines`)));
3228
+ server.tool("loop_get_trace_pipelines", "Which pipelines one conversation feeds: every live pipeline whose tags or datasets select it (and whose conditions keep it), and whether each is switched on. Being listed means the pipeline would select it, not that it will be trained on — training still drops duplicates and answers it cannot use, and keeps some aside for the automatic test. Each pipeline's state says what happens to it there: held_back (kept aside for the automatic test, never trained on), learned (version_no learned it), trained (training attempt_no learned from it and did not become a version), waiting (for the next training) or left_out (not trained on as it is), and reason is the sentence to read back (for left_out, why). An empty list is a real answer: the conversation counts toward 'reviewed' and trains nothing, so add a pipeline's tag to it (loop_label_trace) if it should.", { trace_id: z.string().describe("ID of the saved sample returned by loop_list_traces.") }, async ({ trace_id }) => json(await client.api(`/api/loop/traces/${encodeURIComponent(trace_id)}/pipelines`)));
3217
3229
  server.tool("loop_stats", "How much has been recorded in this workspace, how much of it has feedback, and how many samples a pipeline could train on right now (ready.sft: the ones marked good or corrected). ready.sft is an upper bound: duplicates, the samples kept aside for the automatic test and conversations too long to train on come out of it when a training starts. capture lists the calls sent with X-Loop-Pipeline in the last capture.days days that were not recorded under a name the header gave, one entry per name (a call naming two is counted under each, so never add entries up as calls): reason no_pipeline (no pipeline has that pipeline ID: misspelt, never made, or deleted), too_large or incomplete (the answer could not be kept); empty when every call was recorded. The workspace's totals: samples_recent is how many samples were recorded in the last 48 hours; feedback counts every sample by the feedback a person gave it (good, bad, corrected, unreviewed -- they add up to the 'traces' total, every sample); pipelines is how many pipelines there are and how many are training, needs_you (waiting on the user), serving or paused.", {}, async () => {
3218
3230
  const data = await client.api("/api/loop/stats");
3219
3231
  return json(data);
@@ -3261,7 +3273,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3261
3273
  // it had set a minimum nothing set.
3262
3274
  train_when: z.object({
3263
3275
  schedule: z.object({
3264
- every: z.enum(["day", "week"]),
3276
+ every: z.enum(["day", "week"]).describe("Repeat the training schedule each day or each week."),
3265
3277
  weekday: z.number().int().min(0).max(6).optional().describe("0 is Sunday. Required for 'week'; leave it out for 'day'."),
3266
3278
  hour_utc: z.number().int().min(0).max(23).describe("The UTC hour"),
3267
3279
  }).nullable().optional().describe("Also wait for this time. Training starts only when BOTH the platform's fixed sample minimum and the schedule are met. null trains as soon as the minimum is met."),
@@ -3269,7 +3281,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3269
3281
  promotion: z.object({
3270
3282
  policy: z.enum(["holdout", "all", "primary", "k_of_n", "weighted", "manual"]).describe("How a new version goes live. 'holdout' (default): better on the automatic test (questions from the pipeline's own samples it never trained on). all / primary / k_of_n / weighted: by the pipeline's benchmarks. manual: never put live without a person, a rebuild after a deleted conversation included. Under every other policy a rebuild after a deleted conversation goes live unless it is clearly worse than the live version."),
3271
3283
  k: z.number().int().min(1).optional().describe("For k_of_n only: how many measurements must improve"),
3272
- }).optional(),
3284
+ }).optional().describe("How the new model goes live, including any required benchmark results."),
3273
3285
  // STRICT, and never null: the share is the member's, the floor of 100 and
3274
3286
  // the count are the platform's, and the service refuses anything else by
3275
3287
  // name. zod would otherwise strip holdout.count in silence.
@@ -3315,27 +3327,27 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3315
3327
  method: "PUT",
3316
3328
  body,
3317
3329
  })));
3318
- server.tool("loop_delete_pipeline", "Delete a pipeline for good. A training still running is cancelled; the deployment its live version answers from is stopped and deleted, so the live version stops answering and is no longer billed, unless another pipeline or model name of yours answers from it too. If one does, that deployment keeps running and billed until you stop it on Deployments, and its saved model copy is kept (and billed as storage) until that deployment is deleted. Its history is deleted in the background after the call returns: the saved copies its trainings made, the sets they trained on, and every conversation of their test and benchmark reports. Its samples and tags are kept. Recording from the source named by its pipeline ID stops: an app still sending there gets captured:false. THIS CANNOT BE UNDONE and the name is spent: the response's retained_name can never be used by another pipeline in this workspace. To stop it for now, loop_update_pipeline with enabled false. Confirm with the user first, and say that the live version stops answering and the history is deleted.", { pipeline_id: z.string() }, async ({ pipeline_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}`, { method: "DELETE" })));
3319
- server.tool("loop_run_pipeline", "Train now: start a training without waiting for the schedule. SPEND CONSENT: it trains on real GPUs charged to the wallet, so say so and get a yes. It never skips the minimum: 422 NOT_ENOUGH_SAMPLES carries have and need — read both back. 409 RUN_ACTIVE: a training is already running. A training waiting for GPUs to be tested (active_run.state waiting_gpus) is the one exception: Train now books its two test machines again at once and answers 202; nothing is trained again. With a rebuild on its way (chain.rebuild: a member deleted a conversation the live version learned from), Train now starts the rebuild: a retrain from the original model on every remaining sample, with no wait for new ones, at the version limit too (each rebuild that goes live is a version, so the pipeline can end past its limit). 409 VERSION_LIMIT_REACHED: raise or remove max_versions. 409 RULE_PAUSED: it is switched off or paused (paused_reason says why). 409 PIPELINE_NEEDS_SAVE: its settings changed without a pipeline save; save it with loop_update_pipeline, then train again. 409 MONTHLY_LIMIT_REACHED: the platform's runaway guard for this month; read resumes_at back, unless message says no month fits (then read message back: a smaller model, or a save). 409 SCORING_CAPPED: the comparison's key is at its monthly cap, so what it trained could not be scored; read resumes_at back (the pipeline's scoring_capped_until says the same before you try). 409 LIVE_VERSION_STOPPED: the deployment the live version answers from is stopped, paused or deleted, so a training could not be tested against it; the user resumes it in Deployments or rolls the version back. 503 AGENT_COULD_NOT_START or 409 AGENT_OFF: the key every training's test is scored with could not be renewed just then, so nothing was started; train now again in a minute (saving the pipeline does not help). Do not retry any of the others unchanged.", { pipeline_id: z.string() }, async ({ pipeline_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/run`, {
3330
+ server.tool("loop_delete_pipeline", "Delete a pipeline for good. A training still running is cancelled; the deployment its live version answers from is stopped and deleted, so the live version stops answering and is no longer billed, unless another pipeline or model name of yours answers from it too. If one does, that deployment keeps running and billed until you stop it on Deployments, and its saved model copy is kept (and billed as storage) until that deployment is deleted. Its history is deleted in the background after the call returns: the saved copies its trainings made, the sets they trained on, and every conversation of their test and benchmark reports. Its samples and tags are kept. Recording from the source named by its pipeline ID stops: an app still sending there gets captured:false. THIS CANNOT BE UNDONE and the name is spent: the response's retained_name can never be used by another pipeline in this workspace. To stop it for now, loop_update_pipeline with enabled false. Confirm with the user first, and say that the live version stops answering and the history is deleted.", { pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines.") }, async ({ pipeline_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}`, { method: "DELETE" })));
3331
+ server.tool("loop_run_pipeline", "Train now: start a training without waiting for the schedule. SPEND CONSENT: it trains on real GPUs charged to the wallet, so say so and get a yes. It never skips the minimum: 422 NOT_ENOUGH_SAMPLES carries have and need — read both back. 409 RUN_ACTIVE: a training is already running. A training waiting for GPUs to be tested (active_run.state waiting_gpus) is the one exception: Train now books its two test machines again at once and answers 202; nothing is trained again. With a rebuild on its way (chain.rebuild: a member deleted a conversation the live version learned from), Train now starts the rebuild: a retrain from the original model on every remaining sample, with no wait for new ones, at the version limit too (each rebuild that goes live is a version, so the pipeline can end past its limit). 409 VERSION_LIMIT_REACHED: raise or remove max_versions. 409 RULE_PAUSED: it is switched off or paused (paused_reason says why). 409 PIPELINE_NEEDS_SAVE: its settings changed without a pipeline save; save it with loop_update_pipeline, then train again. 409 MONTHLY_LIMIT_REACHED: the platform's runaway guard for this month; read resumes_at back, unless message says no month fits (then read message back: a smaller model, or a save). 409 SCORING_CAPPED: the comparison's key is at its monthly cap, so what it trained could not be scored; read resumes_at back (the pipeline's scoring_capped_until says the same before you try). 409 LIVE_VERSION_STOPPED: the deployment the live version answers from is stopped, paused or deleted, so a training could not be tested against it; the user resumes it in Deployments or rolls the version back. 503 AGENT_COULD_NOT_START or 409 AGENT_OFF: the key every training's test is scored with could not be renewed just then, so nothing was started; train now again in a minute (saving the pipeline does not help). Do not retry any of the others unchanged.", { pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines.") }, async ({ pipeline_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/run`, {
3320
3332
  method: "POST",
3321
3333
  body: {},
3322
3334
  })));
3323
- server.tool("loop_list_live_deployments", "For a pipeline whose live version's deployment was DELETED (live_deployment.status deleted on loop_get_pipeline): the deployments of this workspace that serve exactly the live version's weights, with their status, and the live version itself (live.training_job_id and live.checkpoint_id, what the user deploys again from Deployments). Nothing has to be trained again: the weights are kept. 409 NO_LIVE_VERSION when the pipeline has none. Read-only.", { pipeline_id: z.string() }, async ({ pipeline_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/live/deployments`)));
3324
- server.tool("loop_use_live_deployment", "Answer the pipeline's model name from this deployment of the live version's weights (one loop_list_live_deployments named), after the pipeline's own deployment was deleted. Nothing is trained again and the version number does not change; the deployment bills the user by the hour, like any deployment, so say so. Refused while the pipeline's own deployment still exists (409 LIVE_DEPLOYMENT_PRESENT: the user starts it again in Deployments instead), for other weights (422 DEPLOYMENT_WEIGHTS_DIFFER) and for a deployment that is not running (409 DEPLOYMENT_NOT_RUNNING). A later rollback stops it.", { pipeline_id: z.string(), deployment_id: z.string() }, async ({ pipeline_id, deployment_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/live/deployment`, {
3335
+ server.tool("loop_list_live_deployments", "For a pipeline whose live version's deployment was DELETED (live_deployment.status deleted on loop_get_pipeline): the deployments of this workspace that serve exactly the live version's weights, with their status, and the live version itself (live.training_job_id and live.checkpoint_id, what the user deploys again from Deployments). Nothing has to be trained again: the weights are kept. 409 NO_LIVE_VERSION when the pipeline has none. Read-only.", { pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines.") }, async ({ pipeline_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/live/deployments`)));
3336
+ server.tool("loop_use_live_deployment", "Answer the pipeline's model name from this deployment of the live version's weights (one loop_list_live_deployments named), after the pipeline's own deployment was deleted. Nothing is trained again and the version number does not change; the deployment bills the user by the hour, like any deployment, so say so. Refused while the pipeline's own deployment still exists (409 LIVE_DEPLOYMENT_PRESENT: the user starts it again in Deployments instead), for other weights (422 DEPLOYMENT_WEIGHTS_DIFFER) and for a deployment that is not running (409 DEPLOYMENT_NOT_RUNNING). A later rollback stops it.", { pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines."), deployment_id: z.string().describe("Existing live deployment ID returned for the pipeline by loop_list_live_deployments.") }, async ({ pipeline_id, deployment_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/live/deployment`, {
3325
3337
  method: "POST",
3326
3338
  body: { deployment_id },
3327
3339
  })));
3328
3340
  server.tool("loop_import_into_pipeline", "loop_import_rows with every row given this pipeline's ID (own_tag), so the file becomes this pipeline's samples. source defaults to the pipeline ID. default_feedback 'good' records every answered row that brought no feedback of its own as a good example to learn from — use it only when the user says the file's answers are good; without it such rows wait for review. The result, the retry token (import_id) and the 5000-row limit are loop_import_rows' own.", {
3329
- pipeline_id: z.string(),
3341
+ pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines."),
3330
3342
  rows: z.array(z.record(z.string(), z.any())).describe("The rows, already parsed, at most 5000, each in the shape it already has"),
3331
3343
  default_feedback: z.enum(["good"]).optional().describe("'good' makes every answered row without its own feedback a good example"),
3332
3344
  source: z.string().optional().describe("Where the rows came from. Defaults to the pipeline ID."),
3333
- model: z.string().optional(),
3345
+ model: z.string().optional().describe("Model identifier to associate with the imported samples."),
3334
3346
  labels: z.array(z.string()).optional().describe("More tags for every row, beside the pipeline's own"),
3335
- attributes: z.record(z.string(), z.string()).optional(),
3347
+ attributes: z.record(z.string(), z.string()).optional().describe("String-valued metadata to attach to every imported row."),
3336
3348
  import_id: z.string().optional().describe("Repeat a previous call's import_id to RETRY it without storing rows twice"),
3337
- row_offset: z.number().int().min(0).optional(),
3338
- row_ids: z.array(z.string()).optional(),
3349
+ row_offset: z.number().int().min(0).optional().describe("Zero-based position of the first row in this batch within the original file."),
3350
+ row_ids: z.array(z.string()).optional().describe("Stable source identifiers for the input rows, in the same order as rows."),
3339
3351
  }, async ({ pipeline_id, ...body }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/import`, {
3340
3352
  method: "POST",
3341
3353
  body,
@@ -3363,7 +3375,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3363
3375
  };
3364
3376
  server.tool("loop_list_datasets", "The workspace's saved datasets, most recently changed first: each with its conditions, how many samples it selects now (samples, by feedback in feedback_counts), how many of them are in a benchmark and so never trained on (in_benchmarks), and the pipelines that train on it (used_by). A page: total says how many there are; pass offset for the next page.", {
3365
3377
  limit: z.number().int().min(1).max(200).optional().describe("How many datasets, 50 when absent, at most 200"),
3366
- offset: z.number().int().min(0).optional(),
3378
+ offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
3367
3379
  }, async ({ limit, offset }) => json(await client.api("/api/loop/datasets", {
3368
3380
  params: { limit: limit?.toString(), offset: offset ? offset.toString() : undefined },
3369
3381
  })));
@@ -3393,7 +3405,7 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3393
3405
  }, async (body) => json(await client.api("/api/loop/datasets", { method: "POST", body })));
3394
3406
  server.tool("loop_update_dataset", "Change a saved dataset: send ONLY what changes (null clears origin, model, from or to; [] clears tags or feedback). Every pipeline in its used_by trains on the new selection from its next training: samples that join count as new samples and can bring a pipeline to its next training, which is paid from the wallet, so widening a dataset a pipeline uses is SPEND CONSENT for that pipeline: say which pipelines it changes first and wait for a yes. Nothing is trained again and versions already made keep what they learned. Pass expected_revision to be refused REVISION_MISMATCH rather than overwrite someone else's edit.", {
3395
3407
  dataset_id: z.string().describe("The dataset's id, from loop_list_datasets"),
3396
- name: z.string().min(1).max(80).optional(),
3408
+ name: z.string().min(1).max(80).optional().describe("Updated display name for this dataset."),
3397
3409
  ...datasetConditionsShape,
3398
3410
  expected_revision: z.number().int().min(1).optional().describe("The revision you read"),
3399
3411
  }, async ({ dataset_id, ...body }) => json(await client.api(`/api/loop/datasets/${encodeURIComponent(dataset_id)}`, {
@@ -3407,12 +3419,12 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3407
3419
  state: z.string().optional().describe("Only trainings in this state, e.g. 'awaiting_review'"),
3408
3420
  result: z.enum(["became_version", "not_better", "inconclusive", "not_tested", "failed", "stopped", "running", "waiting_for_review"]).optional()
3409
3421
  .describe("Only the trainings that ended this way, as loop_list_pipeline_attempts filters them; running includes one waiting for a decision"),
3410
- limit: z.number().int().min(1).max(200).optional(),
3411
- offset: z.number().int().min(0).optional(),
3422
+ limit: z.number().int().min(1).max(200).optional().describe("Maximum number of matching records to return on this page."),
3423
+ offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
3412
3424
  }, async ({ rule_id, state, result, limit, offset }) => json(await client.api("/api/loop/training-runs", {
3413
3425
  params: { rule_id, state, result, limit: limit?.toString(), offset: offset?.toString() },
3414
3426
  })));
3415
- server.tool("loop_get_training_run", "One training in full: whether it was tested (tested: its comparison measured something -- a training never tested can never go live, and available_actions.retest says loop_retest_training_run can test it again), the model it trained (base_model_id, model_family) and the recipe, how the platform trained it (training_summary, the service's own sentence -- the steps it took, the passes planned over its samples and the step it kept; read it back as written, and trained_steps is the steps the trainer counted, never an estimate; both null until its training ended, and on a training from before), the samples it learned from and the ones kept aside for its automatic test ('lineage' says what it was built on: trained_from versions -- it builds on built_on's versions -- or base, from the original model, with from_base_reason; and train_rows = new_samples + carried_samples, from trainings that did not become a version, + replayed_samples, samples those versions already learned, gone over again so they are not forgotten (the counts are null on a training from before trainings built on earlier versions, or of a pipeline that does not build on its live version: say only train_rows then); say them as 'learned N new samples', 'N from training #5, which did not become a version' and 'went over N samples it had learned before'; error_code CHAIN_MOVED means it was built on a version that was rolled back while it trained, so it was set aside with no test paid and its samples go to the next training, NO_MERGED_EXPORT that its training finished without the single model it is served as, TRAINING_SERVICE_BEHIND that the platform's training service was being updated when it asked for its training, so it stopped before any training started with nothing charged and the next training asks again (STEP_STALLED:TRAINING_SERVICE_BEHIND: the same after six hours of waiting for that update; the pipeline tries again on its own), STEP_STALLED:SERVING_NOT_CERTIFIED that the platform had not yet checked it can test new versions of this model on its current serving engine, so it waited six hours before its training and stood down with nothing charged and the pipeline not paused (its next training waits the same way until that check is done; CHECKPOINT_NOT_DEPLOYABLE:SERVING_NOT_CERTIFIED is the same found at its comparison, after it trained), and ENV_GATED:SWITCHED_OFF that the Conscious Loop was switched off on the platform before its training started, so it stopped there with no GPU time charged), its GPU time and what it was billed (billed_candidate_up_to true means billed_candidate_cents is a ceiling: a test machine was charged in it, counted from its first boot while the platform bills from its first answer, and at the hourly cap when no price was reported -- say 'at most', never 'spent'; it is false again once billing has settled every such machine, and the timeline then says, one line per machine, what billing charged for the time it served and what it had been counted at -- read that line back when a cost changed; the new model's machine of a training that went live (a version) or that a person took over is never settled, so that training stays 'at most'; comparison_returned_cents above 0 means a test machine never started (never reached running) and was not charged -- the platform bills it nothing, and the figures beside it are already net of it -- so say 'Test machine: not charged (it never started)' -- or, while a comparison figure above 0 remains beside it, that the one that never started was not charged and the one that ran was -- never that it was charged), the timeline of every state it passed through and why, links to the training itself, the newly trained model and its test, benchmark_runs (every benchmark it was tested on; each run_id is that benchmark run's id for loop_get_benchmark_run and loop_list_benchmark_run_items), 'promotion' (outcome as the pipeline's trainings list says it; decision, where rejected means a member chose not to publish it even when the result says better, auto_rejected that the pipeline's going-live choice turned it down on its own, and expired that nobody decided before the review deadline -- an expired training whose result is better was better, never say the pipeline refused it; and the going-live choice's reason and every measurement it read, each better, not_better, worse or not_measured with its reason -- null and empty when nothing was recorded), verdict_checks (every bar the automatic test had to clear -- questions compared, failures, a rubric set, mean change, how often the new answer scored higher, and the chance a model no better would score higher this often -- each with needed, got and met; null until the test is finished, when no thresholds were recorded, and for a report decided under earlier bars that these would not explain: when the user asks why a training did not go live, read the bars that are not met back in these words), verdict_checks_withheld (decided_under_earlier_rule when a finished report's bars are withheld because an earlier version of the platform's bars decided it, null otherwise: then say the test was decided under an earlier version of the platform's bars, so its bars are not listed -- its result stands as recorded; never say they were not recorded, and never work them out from today's bars), cost (training_cents, comparison_cents, scoring_cents, benchmark_cents, sample_scoring_cents -- what the judge's scoring of unreviewed samples cost before the training -- and total_cents, the training's cost_cents on the pipeline; up_to true means comparison_cents and the total are 'at most' figures, counted from the test machines' first boot, and false once billing has settled every one of them (the timeline says what each was charged); comparison_returned_cents is what was taken off comparison_cents for a machine that never started: say it was not charged, and that comparison_cents above 0 is the one that ran), explanation (what became of it in plain words, as on the pipeline's trainings list: read it back rather than the codes), model_role, builds_on_version, compared_with_version, compared_with and missed_bar (as loop_list_pipeline_attempts says them), run.trained_on (what it trained on as it was then: the pipeline's tags, its conditions and each dataset at its revision; null when its set is gone), traces_filter_attempt (true: loop_list_traces with 'attempt' and 'split' lists its samples), and available_actions — which says what THIS reader may actually do next. Use available_actions rather than guessing from the state: a training can look ready to go live and not be, because the consent moved or the newly trained model is already gone.", { run_id: z.string() }, async ({ run_id }) => json(await client.api(`/api/loop/training-runs/${encodeURIComponent(run_id)}`)));
3427
+ server.tool("loop_get_training_run", "One training in full: whether it was tested (tested: its comparison measured something -- a training never tested can never go live, and available_actions.retest says loop_retest_training_run can test it again), the model it trained (base_model_id, model_family) and the recipe, how the platform trained it (training_summary, the service's own sentence -- the steps it took, the passes planned over its samples and the step it kept; read it back as written, and trained_steps is the steps the trainer counted, never an estimate; both null until its training ended, and on a training from before), the samples it learned from and the ones kept aside for its automatic test ('lineage' says what it was built on: trained_from versions -- it builds on built_on's versions -- or base, from the original model, with from_base_reason; and train_rows = new_samples + carried_samples, from trainings that did not become a version, + replayed_samples, samples those versions already learned, gone over again so they are not forgotten (the counts are null on a training from before trainings built on earlier versions, or of a pipeline that does not build on its live version: say only train_rows then); say them as 'learned N new samples', 'N from training #5, which did not become a version' and 'went over N samples it had learned before'; error_code CHAIN_MOVED means it was built on a version that was rolled back while it trained, so it was set aside with no test paid and its samples go to the next training, NO_MERGED_EXPORT that its training finished without the single model it is served as, TRAINING_SERVICE_BEHIND that the platform's training service was being updated when it asked for its training, so it stopped before any training started with nothing charged and the next training asks again (STEP_STALLED:TRAINING_SERVICE_BEHIND: the same after six hours of waiting for that update; the pipeline tries again on its own), STEP_STALLED:SERVING_NOT_CERTIFIED that the platform had not yet checked it can test new versions of this model on its current serving engine, so it waited six hours before its training and stood down with nothing charged and the pipeline not paused (its next training waits the same way until that check is done; CHECKPOINT_NOT_DEPLOYABLE:SERVING_NOT_CERTIFIED is the same found at its comparison, after it trained), and ENV_GATED:SWITCHED_OFF that the Conscious Loop was switched off on the platform before its training started, so it stopped there with no GPU time charged), its GPU time and what it was billed (billed_candidate_up_to true means billed_candidate_cents is a ceiling: a test machine was charged in it, counted from its first boot while the platform bills from its first answer, and at the hourly cap when no price was reported -- say 'at most', never 'spent'; it is false again once billing has settled every such machine, and the timeline then says, one line per machine, what billing charged for the time it served and what it had been counted at -- read that line back when a cost changed; the new model's machine of a training that went live (a version) or that a person took over is never settled, so that training stays 'at most'; comparison_returned_cents above 0 means a test machine never started (never reached running) and was not charged -- the platform bills it nothing, and the figures beside it are already net of it -- so say 'Test machine: not charged (it never started)' -- or, while a comparison figure above 0 remains beside it, that the one that never started was not charged and the one that ran was -- never that it was charged), the timeline of every state it passed through and why, links to the training itself, the newly trained model and its test, benchmark_runs (every benchmark it was tested on; each run_id is that benchmark run's id for loop_get_benchmark_run and loop_list_benchmark_run_items), 'promotion' (outcome as the pipeline's trainings list says it; decision, where rejected means a member chose not to publish it even when the result says better, auto_rejected that the pipeline's going-live choice turned it down on its own, and expired that nobody decided before the review deadline -- an expired training whose result is better was better, never say the pipeline refused it; and the going-live choice's reason and every measurement it read, each better, not_better, worse or not_measured with its reason -- null and empty when nothing was recorded), verdict_checks (every bar the automatic test had to clear -- questions compared, failures, a rubric set, mean change, how often the new answer scored higher, and the chance a model no better would score higher this often -- each with needed, got and met; null until the test is finished, when no thresholds were recorded, and for a report decided under earlier bars that these would not explain: when the user asks why a training did not go live, read the bars that are not met back in these words), verdict_checks_withheld (decided_under_earlier_rule when a finished report's bars are withheld because an earlier version of the platform's bars decided it, null otherwise: then say the test was decided under an earlier version of the platform's bars, so its bars are not listed -- its result stands as recorded; never say they were not recorded, and never work them out from today's bars), cost (training_cents, comparison_cents, scoring_cents, benchmark_cents, sample_scoring_cents -- what the judge's scoring of unreviewed samples cost before the training -- and total_cents, the training's cost_cents on the pipeline; up_to true means comparison_cents and the total are 'at most' figures, counted from the test machines' first boot, and false once billing has settled every one of them (the timeline says what each was charged); comparison_returned_cents is what was taken off comparison_cents for a machine that never started: say it was not charged, and that comparison_cents above 0 is the one that ran), explanation (what became of it in plain words, as on the pipeline's trainings list: read it back rather than the codes), model_role, builds_on_version, compared_with_version, compared_with and missed_bar (as loop_list_pipeline_attempts says them), run.trained_on (what it trained on as it was then: the pipeline's tags, its conditions and each dataset at its revision; null when its set is gone), traces_filter_attempt (true: loop_list_traces with 'attempt' and 'split' lists its samples), and available_actions — which says what THIS reader may actually do next. Use available_actions rather than guessing from the state: a training can look ready to go live and not be, because the consent moved or the newly trained model is already gone.", { run_id: z.string().describe("ID of the existing training in this workspace. Copy it from the training details or a previous listing.") }, async ({ run_id }) => json(await client.api(`/api/loop/training-runs/${encodeURIComponent(run_id)}`)));
3416
3428
  server.tool("loop_list_pipelines", "Every pipeline in the workspace: the versions it has made (a version is a training that went live; attempts[] lists every training, whether it became a version or not, each with its outcome, trigger and decision -- rejected means a member chose not to publish it, where outcome says stopped, and expired that nobody decided before the review deadline; auto_rejected that the pipeline's going-live choice turned it down on its own; an expired training whose result is better was better: never say the pipeline refused it -- and train_rows and holdout_rows, the samples it learned from and the ones kept aside for its automatic test; each training is tested on at most scored_rows (1,500) of the automatic test's samples, the ones kept aside longest first; a sample once kept aside stays kept aside, so later trainings are mostly asked the same questions, plus newer ones while fewer than 1,500 are kept aside), which one serves the app today -- the live version, the version the app gets answers from right now (live_version, null when what serves is not one of its versions) and whether its deployment still answers (live_deployment.status: serving answers; starting is on its way up; stopped, paused_for_funds or deleted answers nothing and is not billed; paused_by_platform was paused because billing could not be reached and answers nothing; failed answers nothing; live_deployment null means no check is recorded yet or what serves is not a deployment -- never say a live version with any status but serving is answering the app), how each version did against what it was tested against (the live version of its day, or before v1 the original model) and on the standing benchmark, versions_made against max_versions, the training in progress and which version it will become, and status. Read-only. When the user asks 'is this getting better' or 'what is it doing', answer from this, and read status back honestly: needs_review and needs_funds are waiting on THEM (a decision, a top-up), paused names why in paused_reason (consent_invalid means its settings changed since it was last saved: saving it again starts it), complete means the version limit is reached, and running is the platform working -- including a training whose active_run.state is waiting_gpus: it trained, but no GPUs were free to serve the new model and the one it is tested against side by side, so both machines were stopped; each try can bill the machine that got a GPU for up to 20 minutes while it waits for the other, nothing bills between tries, it keeps what it trained, tries again after 30 minutes, then 1, 2 and 4 hours, and ends after four tries or 24 hours (its last_reason says when; a last_reason opening 'waiting for room in this workspace to compare' means the workspace is at its limit of running deployments, and stopping a deployment lets it start), and Train now tries again at once. cost_up_to true on a training, active_run or a version means its cost_cents is a ceiling: a test machine was charged in it, counted from its first boot while the platform bills it from its first answer (and at the hourly cap when no price was reported), so say 'at most', never 'spent'. It is false again once billing has settled every such machine (the training's timeline says what billing charged each one for the time it served). A version's own new-model machine is the one that went live and is never settled, so a version whose machine was charged stays 'at most'. On a training or active_run, comparison_returned_cents above 0 means a test machine never started (never reached running) and was not charged -- the platform bills it nothing, and the figures beside it are already net of it -- so say 'Test machine: not charged (it never started)' -- or, while a comparison figure above 0 remains beside it, that the one that never started was not charged and the one that ran was -- never that it was charged. next_reason is the pipeline's own sentence about what it is waiting for. scoring_capped_until, when set, is when the workspace's scoring key comes off its monthly cap: until then nothing trains and Train now answers SCORING_CAPPED, so say so instead of offering Train now. A monthly safety limit, set by the platform from the model's prices, can hold a pipeline until the 1st of next month (UTC): next_reason then says so, and Train now answers 409 MONTHLY_LIMIT_REACHED with resumes_at. It has no field and no figure to read back. A pipeline trains only on new samples: it never retrains the conversations a training already had with a recipe changed. The list is a page (100 unless limit says, at most 100), newest first: total is how many pipelines match and truncated is true when more exist after this page. When truncated, say it is the newest of total, and pass offset (this page's offset plus its length) for the next page. q finds pipelines by name, pipeline ID or model; status keeps those training, waiting on the user (needs_you), serving or paused. Each pipeline's attempts[] here is its latest 5 trainings and its versions[] the latest few and the live one (attempts_total and versions_total say how many there are); totals is every training it made, as on loop_get_pipeline; loop_get_pipeline has every version, and loop_list_pipeline_attempts reads every training. Each training's explanation is its outcome in plain words (headline, detail, next): read those back rather than the codes. Each pipeline carries samples_total and samples_recent (recorded in the last 48 hours), and minimums with have and short, as loop_get_pipeline does. second_model is as loop_get_pipeline describes it, except that here it can also be null when where the second model stands could not be read just then: when challenger_model still names one, say its state could not be read, never that the pipeline has no second model.", {
3417
3429
  limit: z.number().int().min(1).max(100).optional().describe("How many pipelines, 100 when absent, at most 100"),
3418
3430
  offset: z.number().int().min(0).optional().describe("How many of the newest pipelines to skip"),
@@ -3441,48 +3453,48 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3441
3453
  },
3442
3454
  })));
3443
3455
  server.tool("loop_get_pipeline", "One pipeline in full, by its id. Words to use with the user: a training is one numbered try at a better model (#1, #2 ...; in the API's names, 'attempt', and its id is run_id); a version is a training that went live (v1, v2 ... with no limit); the live version is the version the app gets answers from right now; the automatic test is questions from the pipeline's own samples that the model never trained on. What it trains on (tags, the datasets it adds, and the conditions that narrow both), samples_total (samples recorded so far, the same samples loop_list_traces with pipeline lists) and samples_recent (in the last 48 hours), auto_scoring (the judge's scoring of its unreviewed samples, null where the platform does not score them: read its message back as written; picked, below_bar and unscored add up to its unreviewed samples), minimums.picked_by_judge (how many of the samples it has the judge picked), every version with its result, the decision a person made, its win_rate (of the test questions where the two answers scored differently, the share where the new one scored higher), its pass rates on the automatic test (candidate_pass_rate for the new model and incumbent_pass_rate for what it was tested against: the live version then, or the original model before v1; the share each side passed, score 0.70 or more -- say it as 'right on 97% of its test (v4 got 85% on the same questions)', or before v1 'right on 97% of its test (the original model got 85% on the same questions)') and benchmark score, what it cost and why it was made (trigger, in the same words as attempts[]), plus the training in progress. When the monthly safety limit holds it, next_reason says so; the limit has no field. Read-only: putting a training live, rejecting it and going back to an earlier version stay on the training tools, and its settings on loop_update_pipeline. minimums says how many samples it has against what the next training needs. scoring_capped_until, when set, is when the workspace's scoring key comes off its monthly cap: until then nothing trains and Train now answers SCORING_CAPPED with that time as resumes_at. Only compare benchmark scores whose benchmark_comparable is true; the others were measured on a different yardstick. versions[] holds ONLY the trainings that went live, numbered v1, v2 ... in the order they went live, each with its 'attempt' (training number), base_model_id and model_family -- and live_version is the one the app's model name reaches now, with live_deployment.status saying whether its deployment answers (serving answers; starting is on its way up; stopped, paused_for_funds or deleted answers nothing and is not billed; paused_by_platform was paused because billing could not be reached and answers nothing; failed answers nothing; null when no check is recorded yet or what serves is not a deployment; live_deployment.deployment_id is the deployment to open); attempts[] is the pipeline's latest 20 trainings, whether they became a version or not (attempts_total says how many it ran, and loop_list_pipeline_attempts pages through every one; each also carries model_role, builds_on_version, compared_with_version, compared_with and missed_bar, as loop_list_pipeline_attempts says them), totals is every training it made in one object -- trainings, trainings_finished, trainings_untested (trained but never measured), trainings_by_result, trainings_by_model {main, second}, versions, spent_cents (every training's cost_cents added up, plus scoring_not_yet_in_a_training_cents -- what scoring unreviewed samples cost that no training has taken yet: training and testing, not the live version's serving), spent_up_to (true when any of them is an upper bound), spent_so_far (true while the figure can still change -- a training running or waiting for a member, billing settling one, or scoring running) -- say the two together: neither '$X', only spent_up_to 'at most $X', only spent_so_far '$X so far' (never 'at most' for a figure still growing), both 'at most $X so far' -- spent_parts {training_cents, test_machine_cents, grading_cents, benchmark_cents, sample_scoring_cents} adding up to it, gpu_seconds, first_training_at and last_training_at -- so when the user asks how many trainings, how many versions or what the pipeline has cost in all, read totals rather than adding up attempts[], each with explanation (its outcome in plain words: headline, detail, next -- read it back rather than the codes) and its outcome (became_version, not_better, 'inconclusive' -- its test ran and could not decide, or compared nothing; its explanation says which and why --, not_tested -- it ended before it was tested --, stopped, failed, running, waiting_for_review), trigger (data, schedule, manual, 'challenger' for the second model -- each model keeps its own line of versions: the second model builds on its own latest version, never on the main model's, and trains from its original model on all samples while it has none; model_role says which model a training trained (main or second) -- or rebuild, a retrain from the original model after a member deleted a conversation the live version learned from), decision (what was decided about it once tested, and by whom: 'promoted', auto_promoted, rejected, auto_rejected, expired or rolled_back; null while nothing has been -- rejected means a member chose not to publish it, where outcome says stopped, so say a member declined it rather than that it stopped; 'promoted' that a member put it live and auto_promoted that the pipeline's going-live choice did; auto_rejected that the pipeline's going-live choice turned it down on its own; expired that nobody decided before the review deadline, so it was retired undecided -- an expired training whose result is better reads stopped and was better: never say the pipeline refused it), and train_rows and holdout_rows (the samples it learned from and the ones kept aside for its automatic test; null until its set was built). 'lineage' on each version, training and the training in progress says what it was built on: trained_from versions (it builds on the live version: the versions in built_on, oldest first, served together as one model) or base (from the original model, with from_base_reason: first_version, 'challenger' (the second model's first training), rebuild -- a deleted conversation when lineage.rebuild is true, or, when it is false, a model's own latest version already built on 64 versions, the most one training can build on, so that model's line starts again -- model_cannot_build_on, chain_link_unreadable, or line_learned_deleted: a version of that model's own line learned a sample a member deleted, so its line starts again without it), and what it trained on -- train_rows = new_samples + carried_samples (samples of the trainings in carried_from_attempts, which did not become a version, learned again) + replayed_samples (about half: as many as new_samples + carried_samples, or all of learned_before when that is fewer, picked at random from what the versions it builds on already learned and gone over again, so they are not forgotten); learned_before is what those versions had learned and was not trained again, except the ones gone over again; served_as says how it is served -- an expert detail, never needed in an answer; learned_deleted_conversation true means it, or a version it was built on, learned a conversation that was deleted, so it can no longer be gone back to. The counts are null on a training from before trainings built on earlier versions, or of a pipeline that does not build on its live version: say only train_rows then. Say it in these words: 'Builds on v4. Learned 3,000 new samples: 2,000 that arrived since v4 and 1,000 from training #3, which did not become a version. It also went over 3,000 samples it had learned before, so it does not forget them.' -- name the part it went over again whenever replayed_samples is above 0, so the parts add up to train_rows; never say 'replayed', 'on top of' or 'v1 + v2'. second_model, when the pipeline names one, is where the second model stands: state (waiting -- it trains next, or after the main model's next training; training; tested; skipped -- it did not train on the main model's newest samples and will not, a skip is never a training and costs nothing; held -- a money limit, the scoring key, a live version that cannot answer, a rollback under way or a paused pipeline holds it; none -- the pipeline trains neither model now), for_training (the training the state is about), last_training, own_latest_version (the version it builds on next; null: it trains from its original model) and reason, its state in one plain sentence to read back as written; a second-model training that ends untested -- one that trained but could not be tested included -- is trained once more on the same samples (not one a member stopped, one refused for its model, or one stopped by its own spending limit). chain, when set, is the live version and the versions it is built from (versions, live one last), learned_samples and not_learned_samples (learned by trainings that did not become a version, so learned again next), and rebuild when a deleted conversation the live version learned has a retrain from the original model on its way; chain null means the pipeline does not build on its live version and every training starts from the original model on all samples. Nothing in progress is a version yet. 'holdout' is the automatic test's share: percent (5 to 20), min_rows (at least that many samples are kept aside whatever the share), 'rows' (how many it keeps aside today) and held_before (how many of those an earlier training of the pipeline kept aside: they stay kept aside whatever became of that training and whatever the share says, so a lower share releases none of them; before the first version the first training needs held_before plus 1,000 to train on when that is more than the share asks for). Each training is tested on at most scored_rows (1,500) of the automatic test's samples, the ones kept aside longest first (a sample once kept aside stays kept aside, so later trainings are mostly asked the same questions, plus newer ones while fewer than 1,500 are kept aside), so keeping more aside than that only keeps samples out of training. storage is what the pipeline's history takes up in storage (bytes, objects, where: platform, your_storage or both, and billed): every conversation, answer and scoring reason of its reports, and the training data its trainings are built from, is kept there and never in the database; it counts toward the workspace's storage quota and is deleted with the pipeline. Only the part in the platform's storage is ever billed, as Conscious Loop storage at the storage rate with no daily minimum (each day's cost is added up and charged once it reaches a whole cent), and only when billed is true; the part in the workspace's own storage never is -- with billed false, say it is not billed. Deleting the pipeline deletes its history and stops that charge. Where the pipeline builds on its live version, the saved model copies its versions answer from (the live one's, and each one going back can still put back; a training that did not become a version keeps its copy, billed, until it is cleaned up within a day) are billed as model storage, like any trained model, and each version's own saved training state is billed as storage, like any training's; its reports, benchmark results and training data are billed only as its storage says (billed). An active_run whose last_reason says it is waiting for storage is holding answers already paid for until storage can keep them; they are kept then without asking the models again. cost_up_to true on attempts[], active_run or versions[] means that cost_cents is a ceiling: a test machine was charged in it, counted from its first boot while the platform bills from its first answer (and at the hourly cap when no price was reported), so say 'at most', never 'spent'. It is false again once billing has settled every such machine (the training's timeline says what billing charged each one for the time it served). A version's own new-model machine is the one that went live and is never settled, so a version whose machine was charged stays 'at most'. On attempts[] and active_run, comparison_returned_cents above 0 means a test machine never started (never reached running) and was not charged -- the platform bills it nothing, and the figures beside it are already net of it -- so say 'Test machine: not charged (it never started)' -- or, while a comparison figure above 0 remains beside it, that the one that never started was not charged and the one that ran was -- never that it was charged. An active_run.state of waiting_gpus means the training finished and is waiting for GPUs to serve the new model and the one it is tested against side by side: each try can bill the machine that got a GPU for up to 20 minutes while it waits for the other, nothing bills between tries, it keeps what it trained, tries again after 30 minutes, then 1, 2 and 4 hours, and ends after four tries or 24 hours (its last_reason says when; a last_reason opening 'waiting for room in this workspace to compare' means the workspace is at its limit of running deployments, and stopping a deployment lets it start), and Train now tries again at once. training is the pipeline's training settings ('epochs', learning_rate, lora_rank, lora_alpha, replay_percent), each null while automatic, and training_defaults what automatic means for its model (learning_rate, lora_rank, lora_alpha, replay_percent, and min_epochs to max_epochs); say 'automatic' for a null, never a guessed number. capture lists the calls sent with X-Loop-Pipeline in the last capture.days days that were not recorded, one entry per name the header gave (a call naming two is counted under each, so never add entries up as calls): under this pipeline's own names too_large or incomplete (the answer could not be kept), and under any name no pipeline had no_pipeline (misspelt, or a deleted pipeline's); empty when every call was recorded. On attempts[], versions[] and active_run, sample_scoring_cents is what the judge's scoring of unreviewed samples cost before that training (already inside cost_cents, never added to it), sample_scored and sample_picked what it scored and picked, and train_rows_by_judge how many of train_rows the judge picked rather than a person; each training's trained_on is what it trained on as it was then (its tags, conditions and each dataset at its revision).", { rule_id: z.string().describe("The pipeline's id, from loop_list_pipelines") }, async ({ rule_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(rule_id)}`)));
3444
- server.tool("loop_list_pipeline_benchmarks", "The benchmarks a pipeline is measured on (each a fixed set of the user's own questions), in priority order (1 is the primary), then the ones it stopped using, and its going-live choice (the 'promotion' field). Every training is tested on each attached benchmark; the going-live choice decides which of those measurements make it a version. Each says how it scores an answer (check: judge, the judge reading its rubric, or exact, the answer must match its right answer) and what its pinned set takes up in storage (storage: bytes, objects, where, billed), so no benchmark needs reading one by one to say either. A benchmark's pinned set is never billed: it is kept until the workspace is deleted, whatever is done with the benchmark, so billed is always false on it -- say it is not billed.", { pipeline_id: z.string() }, async ({ pipeline_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/benchmarks`)));
3456
+ server.tool("loop_list_pipeline_benchmarks", "The benchmarks a pipeline is measured on (each a fixed set of the user's own questions), in priority order (1 is the primary), then the ones it stopped using, and its going-live choice (the 'promotion' field). Every training is tested on each attached benchmark; the going-live choice decides which of those measurements make it a version. Each says how it scores an answer (check: judge, the judge reading its rubric, or exact, the answer must match its right answer) and what its pinned set takes up in storage (storage: bytes, objects, where, billed), so no benchmark needs reading one by one to say either. A benchmark's pinned set is never billed: it is kept until the workspace is deleted, whatever is done with the benchmark, so billed is always false on it -- say it is not billed.", { pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines.") }, async ({ pipeline_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/benchmarks`)));
3445
3457
  server.tool("loop_attach_pipeline_benchmark", "Measure a pipeline on one more benchmark (from loop_list_benchmarks or loop_create_benchmark), last unless priority is given; priority 1 makes it the primary. Applies from the next training; older versions are not measured again and show not_measured for it. 409 BENCHMARK_ALREADY_ATTACHED or BENCHMARK_RETIRED.", {
3446
- pipeline_id: z.string(),
3447
- benchmark_id: z.string(),
3448
- priority: z.number().int().min(1).optional(),
3458
+ pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines."),
3459
+ benchmark_id: z.string().describe("Benchmark identifier returned by loop_list_benchmarks in this workspace."),
3460
+ priority: z.number().int().min(1).optional().describe("One-based position in the pipeline's benchmark ordering. Use the pipeline's benchmark list to choose it."),
3449
3461
  }, async ({ pipeline_id, benchmark_id, priority }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/benchmarks`, {
3450
3462
  method: "POST",
3451
3463
  body: { benchmark_id, priority },
3452
3464
  })));
3453
3465
  server.tool("loop_move_pipeline_benchmark", "Change a benchmark's priority on a pipeline; 1 makes it the primary. 404 BENCHMARK_NOT_ATTACHED when it is not on the list.", {
3454
- pipeline_id: z.string(),
3455
- benchmark_id: z.string(),
3456
- priority: z.number().int().min(1),
3466
+ pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines."),
3467
+ benchmark_id: z.string().describe("Benchmark identifier returned by loop_list_benchmarks in this workspace."),
3468
+ priority: z.number().int().min(1).describe("One-based position in the pipeline's benchmark ordering. Use the pipeline's benchmark list to choose it."),
3457
3469
  }, async ({ pipeline_id, benchmark_id, priority }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/benchmarks/${encodeURIComponent(benchmark_id)}`, {
3458
3470
  method: "PUT",
3459
3471
  body: { priority },
3460
3472
  })));
3461
3473
  server.tool("loop_remove_pipeline_benchmark", "Stop measuring a pipeline on one benchmark. Every score it already produced is kept; when it was the primary, the next one takes its place.", {
3462
- pipeline_id: z.string(),
3463
- benchmark_id: z.string(),
3474
+ pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines."),
3475
+ benchmark_id: z.string().describe("Benchmark identifier returned by loop_list_benchmarks in this workspace."),
3464
3476
  }, async ({ pipeline_id, benchmark_id }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/benchmarks/${encodeURIComponent(benchmark_id)}`, {
3465
3477
  method: "DELETE",
3466
3478
  })));
3467
3479
  server.tool("loop_compare_versions", "A pipeline's versions side by side: each version's result against what it was tested against (the live version then, or the original model before v1) and its score on every benchmark, each with the share of questions each side passed (candidate_pass_rate for the version, incumbent_pass_rate for what it was tested against; score 0.70 or more), with comparable flags. Pass a and b (VERSION numbers, e.g. 1 and 5) for those two and a difference per benchmark; a benchmark attached after a version is not_measured for it, never a zero. Each benchmark says how it scores an answer (check: judge or exact). Compare only scores marked comparable. Each version also says promoted_at, is_live, rolled_back, model_id and model_role (main or second), cost_cents, cost_up_to and gpu_seconds (its training's, as its entry in the list of trainings says them), train_rows, learned_new (the samples it learned that the versions it builds on had not: new plus carried from trainings that did not become a version; null on an older training), compared_with_version and compared_with (what its automatic test asked as the opponent), and holdout.common_pass_rate with holdout.common_rows: how much of common_set -- the samples kept aside for the automatic test before the first tested version (common_set.from), each once, read from stored answers graded against the same right answer -- it got right. common_rows is how many of the set that version's test graded: a sample deleted or past its retention before a later version's test was never asked by it, so say each version's own common_rows unless every version's equals common_set.rows. Use common_pass_rate for 'how has it grown from v1 to now'; each version's own candidate_pass_rate was measured on its own test and is not one line across versions. Each version says whether it was tested (tested): nothing untested goes live any more, and false marks an older version that went live before that held.", {
3468
- pipeline_id: z.string(),
3480
+ pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines."),
3469
3481
  a: z.number().int().min(1).optional().describe("A version number"),
3470
3482
  b: z.number().int().min(1).optional().describe("Another version number"),
3471
3483
  }, async ({ pipeline_id, a, b }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/versions/compare`, {
3472
3484
  params: { a: a?.toString(), b: b?.toString() },
3473
3485
  })));
3474
3486
  server.tool("loop_compare_attempts", "Any two trainings of a pipeline side by side, whether they went live or not -- the one to use for 'why was training #8 not better than #7' or the second model's training against the main model's training whose samples it learned from. a and b are run ids (attempts[].run_id from loop_get_pipeline), two different trainings of this pipeline. Each side has its outcome, decision, its 'lineage' (what it was built on and learned from: 'training #3 builds on v1 and learned 2,000 samples' beside 'training #4 builds on v2 and learned 1,000' is often the difference that matters) and automatic-test numbers against what it was tested against on its day (the live version then, or the original model before v1), with the share each side passed (score 0.70 or more); never subtract two trainings' win_rate figures, the versions they were tested against differ. benchmarks lists every benchmark both were tested on, with delta (b minus a) only where comparable, why otherwise. shared_sample counts the automatic-test questions both were scored on and how many b scored higher, lower or the same on (by the tie band: 0.02 or more above counts as higher; less than 0.02 apart is about the same): these are two absolute scores, not a reading of one answer against the other. shared_sample.a and .b are each training's mean and pass rate over those same questions -- the like-for-like figures, which may be subtracted; each side's 'holdout' numbers are over its own automatic test, which grows between trainings, so do not subtract those. When shared_sample.comparable is false the two were scored differently (another judge model, holdout.judge_model, or another rubric) or how one was scored was not recorded (an older training that froze no rubric is never taken to match): say why in its words, and never read a direction off them. A question whose right answer changed between the two trainings has direction null and says why (answer_changed counts them); so does one where it is not known whether both were scored against the same right answer, because one was compared before that was recorded (answer_unknown counts them; never read those as unchanged or as changed). items is one page of them, numbers and ids only: read an answer with loop_list_evaluation_items on that side's holdout.evaluation_id. filter narrows items and total to one direction, and is refused when the two are not comparable.", {
3475
- pipeline_id: z.string(),
3487
+ pipeline_id: z.string().describe("Workspace pipeline identifier from loop_list_pipelines."),
3476
3488
  a: z.string().describe("The first training's run id"),
3477
3489
  b: z.string().describe("The second training's run id; directions say b against a"),
3478
3490
  filter: z.enum(["higher", "lower", "same"]).optional().describe("Only the conversations where b scored higher, lower, or the same"),
3479
3491
  limit: z.number().int().min(1).max(200).optional().describe("Conversations per page, 50 when absent"),
3480
- offset: z.number().int().min(0).optional(),
3492
+ offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
3481
3493
  }, async ({ pipeline_id, a, b, filter, limit, offset }) => json(await client.api(`/api/loop/pipelines/${encodeURIComponent(pipeline_id)}/attempts/compare`, {
3482
3494
  params: { a, b, filter, limit: limit?.toString(), offset: offset ? offset.toString() : undefined },
3483
3495
  })));
3484
3496
  server.tool("loop_promote_training_run", "Put a training live: point the pipeline's model name at the newly trained model, which becomes the next version and the live version -- from this moment the workspace's traffic is answered by it. Read its test back to the user first (loop_get_evaluation) and get an explicit yes — this changes what real customers get, and it can only be undone for 30 days, with loop_rollback_training_run. A test that COULD NOT DECIDE ('inconclusive') is refused unless force is set, and forcing one means putting live a model nothing showed to be better; say that out loud rather than setting force to get past the error. A training that was never tested (tested false on loop_get_training_run: its test measured nothing) is refused NOT_TESTED, forced or not -- nothing untested goes live; offer loop_retest_training_run instead.", {
3485
- run_id: z.string(),
3497
+ run_id: z.string().describe("ID of the existing training in this workspace. Copy it from the training details or a previous listing."),
3486
3498
  expected_revision: z.number().int().min(0).optional().describe("The pipeline revision the decision was made against. Stale answers CONSENT_CHANGED instead of putting it live under settings that have since changed."),
3487
3499
  force: z.boolean().optional().describe("Put it live even though its test could not decide. Only ever after the user has been told the test did not show the new model was better."),
3488
3500
  }, async ({ run_id, expected_revision, force }) => json(await client.api(`/api/loop/training-runs/${encodeURIComponent(run_id)}/promote`, {
@@ -3490,94 +3502,94 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3490
3502
  body: { expected_revision, force },
3491
3503
  })));
3492
3504
  server.tool("loop_reject_training_run", "Turn a training down: retire the newly trained model and leave the live version exactly where it is. This is the cheap decision: the new model's machine stops being paid for. The trained model's saved copy is kept, so a rejection is not a deletion.", {
3493
- run_id: z.string(),
3505
+ run_id: z.string().describe("ID of the existing training in this workspace. Copy it from the training details or a previous listing."),
3494
3506
  reason: z.string().optional().describe("Why, in the user's own words. It goes on the training's timeline, which is what somebody reads six weeks later."),
3495
3507
  }, async ({ run_id, reason }) => json(await client.api(`/api/loop/training-runs/${encodeURIComponent(run_id)}/reject`, {
3496
3508
  method: "POST",
3497
3509
  body: { reason },
3498
3510
  })));
3499
3511
  server.tool("loop_rollback_training_run", "Go back to the version before: point the pipeline's model name back at what answered before this version went live. Available for 30 days, after which the answer is ROLLBACK_WINDOW_CLOSED and the way back is a new training. 409 RUN_ACTIVE: another training is being tested against this version right now, or builds on it (its lineage.built_on names this version); go back once it finishes, or cancel that training with loop_cancel_training_run first. 409 ROLLBACK_DELETED_DATA: the version it would put back learned from a conversation a member deleted since, so it never answers again; a rebuild without it replaces it. Where the pipeline builds on its live version, the next training builds on the version put back and learns again what the version it replaced learned -- when the version put back is on the pipeline's model now; one on the model before a second model took over cannot be built on, so the next training trains the pipeline's model from its original on every sample. Tell the user what the name will be serving once this lands — the previous target is named on the training.", {
3500
- run_id: z.string(),
3512
+ run_id: z.string().describe("ID of the existing training in this workspace. Copy it from the training details or a previous listing."),
3501
3513
  reason: z.string().optional().describe("Why. It goes on the training's timeline."),
3502
3514
  }, async ({ run_id, reason }) => json(await client.api(`/api/loop/training-runs/${encodeURIComponent(run_id)}/rollback`, {
3503
3515
  method: "POST",
3504
3516
  body: { reason },
3505
3517
  })));
3506
3518
  server.tool("loop_cancel_training_run", "Stop a training that is still running. The training is stopped, the newly trained model is torn down and nothing further is spent on this training. What has already been spent is already spent — cancelling is not a refund, and saying so is more honest than letting the user discover it on the invoice.", {
3507
- run_id: z.string(),
3519
+ run_id: z.string().describe("ID of the existing training in this workspace. Copy it from the training details or a previous listing."),
3508
3520
  reason: z.string().optional().describe("Why. It goes on the training's timeline."),
3509
3521
  }, async ({ run_id, reason }) => json(await client.api(`/api/loop/training-runs/${encodeURIComponent(run_id)}/cancel`, {
3510
3522
  method: "POST",
3511
3523
  body: { reason },
3512
3524
  })));
3513
- server.tool("loop_retest_training_run", "Test again: a training that finished training but was never tested -- no machine was free to test it, or its test could not score a single question (tested false, available_actions.retest true on loop_get_training_run) -- has its test booked again, on the same training. It is tested against what is live now, on the questions kept aside for its automatic test and with its benchmark list, and spends what is left of the amount set aside for testing it, never a second amount. 202 with the training back in checkpoint_ready; asking again while that test is under way changes nothing. 409 CANNOT_TEST_AGAIN says in one plain sentence why it cannot be (already tested, went live, still training, its trained model deleted, the money for testing it spent, ...): read it back as written. Train now's own refusals apply too: PIPELINE_NEEDS_SAVE, RULE_PAUSED, RUN_ACTIVE, MONTHLY_LIMIT_REACHED and SCORING_CAPPED (both with resumes_at), AGENT_OFF. Testing costs money: say so before asking.", { run_id: z.string() }, async ({ run_id }) => json(await client.api(`/api/loop/training-runs/${encodeURIComponent(run_id)}/retest`, {
3525
+ server.tool("loop_retest_training_run", "Test again: a training that finished training but was never tested -- no machine was free to test it, or its test could not score a single question (tested false, available_actions.retest true on loop_get_training_run) -- has its test booked again, on the same training. It is tested against what is live now, on the questions kept aside for its automatic test and with its benchmark list, and spends what is left of the amount set aside for testing it, never a second amount. 202 with the training back in checkpoint_ready; asking again while that test is under way changes nothing. 409 CANNOT_TEST_AGAIN says in one plain sentence why it cannot be (already tested, went live, still training, its trained model deleted, the money for testing it spent, ...): read it back as written. Train now's own refusals apply too: PIPELINE_NEEDS_SAVE, RULE_PAUSED, RUN_ACTIVE, MONTHLY_LIMIT_REACHED and SCORING_CAPPED (both with resumes_at), AGENT_OFF. Testing costs money: say so before asking.", { run_id: z.string().describe("ID of the existing training in this workspace. Copy it from the training details or a previous listing.") }, async ({ run_id }) => json(await client.api(`/api/loop/training-runs/${encodeURIComponent(run_id)}/retest`, {
3514
3526
  method: "POST",
3515
3527
  body: {},
3516
3528
  })));
3517
3529
  server.tool("loop_get_evaluation", "The automatic test behind a training's result: how many questions were scored, win_rate (of the questions where the two answers scored differently, the share where the new model's scored higher), how many questions each side got right (score 0.70 or more: candidate_passed for the new model, incumbent_passed for what it was tested against: the live version then, or the original model before v1; and the pass rates over rows_scored, all four null until the report is finished -- say it as 'right on 31 of 40; v4 got 28 of 40 on the same questions', or before v1 'right on 31 of 40; the original model got 28 of 40 on the same questions'), the mean scores per rubric dimension, the warnings, and the margins the result was measured against. Read the WARNINGS out too, not just the result — 'better' from a judge that rarely agrees with this workspace's reviewers, or from a handful of questions, is a number with a caveat attached, and the caveat is in that list.", { evaluation_id: z.string().describe("From the training's links, or loop_get_training_run") }, async ({ evaluation_id }) => json(await client.api(`/api/loop/evaluations/${encodeURIComponent(evaluation_id)}`)));
3518
3530
  server.tool("loop_list_evaluation_items", "The automatic test question by question: the same prompt, the right answer a person gave for it (reference: answer, kind and the tool_calls it makes; null when none), what the live version answered, what the new model answered, each with the tool_calls it made, what the judge made of each (judge.overall, judge.dimensions and judge.reason, its reason in its own words) and whether each passed (score 0.70 or more), and pairwise: the two answers compared directly, asked in both orders, each with its reason, where one side counts as better only when both orders agree. This is how a person checks a result instead of trusting it. Filter 'winner' to 'serving' to read the questions the new model did WORSE on (the items themselves then say 'incumbent', the live version), which is the honest thing to show somebody before they put it live.", {
3519
- evaluation_id: z.string(),
3531
+ evaluation_id: z.string().describe("Evaluation identifier for the scored items to inspect."),
3520
3532
  winner: z.enum(["candidate", "serving", "tie"]).optional().describe("Only questions with this outcome: 'candidate' (the new model did better), 'serving' (the live version did better) or 'tie'"),
3521
3533
  candidate_passed: z.boolean().optional().describe("true: only questions where the new model's answer passed (score 0.70 or more); false: only questions where it was scored below 0.70. With incumbent_passed it narrows to one cell: candidate_passed false and incumbent_passed true are the ones that got worse. A question that could not be scored matches neither"),
3522
3534
  incumbent_passed: z.boolean().optional().describe("true: only questions where the live version's answer passed (score 0.70 or more); false: only questions where it was scored below 0.70"),
3523
3535
  orders: z.enum(["agreed", "disagreed"]).optional().describe("Only pairs whose two side-by-side orders picked the same side (agreed), or did not"),
3524
3536
  has_reference: z.boolean().optional().describe("Only pairs with (true) or without (false) a right answer"),
3525
- status: z.enum(["scored", "failed"]).optional(),
3537
+ status: z.enum(["scored", "failed"]).optional().describe("Only return items that were scored successfully or failed scoring."),
3526
3538
  sort: z.enum(["ordinal", "score_change"]).optional().describe("score_change: the new model's score less the live version's, largest first"),
3527
3539
  q: z.string().min(2).max(200).optional().describe("Search the conversation (not the system prompt every question shares), the right answer, both answers and every reason (case-insensitive); searched in the answer says how many pairs were read. A search can be refused 429 RATE_LIMITED while this workspace already has a search running or while the service is running as many searches as it can at once, so a 429 does not say which: never tell the user they already had one running; try again after the seconds its message gives"),
3528
3540
  limit: z.number().int().min(1).max(200).optional().describe("50 when omitted, at most 200"),
3529
- offset: z.number().int().min(0).optional(),
3541
+ offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
3530
3542
  }, async ({ evaluation_id, winner, candidate_passed, incumbent_passed, orders, has_reference, status, sort, q, limit, offset }) => json(await client.api(`/api/loop/evaluations/${encodeURIComponent(evaluation_id)}/items`, {
3531
3543
  params: { winner, candidate_passed: candidate_passed?.toString(), incumbent_passed: incumbent_passed?.toString(), orders, has_reference: has_reference?.toString(), status, sort, q, limit: limit?.toString(), offset: offset?.toString() },
3532
3544
  })));
3533
3545
  server.tool("loop_create_benchmark", "Pin a fixed set of 20 to 200 conversations (source.kind 'traces' with trace_ids) as a benchmark: the same questions, each with the right answer a person gave it, scored the same way on every training of every pipeline it is attached to, so 'is it getting better' has a yardstick that does not move. check says how, and is frozen: 'judge' (the default: the judge reads both answers against the right answer) or 'exact' (the answer or the tool call must match the right answer, and no model is asked -- for tool calls, numbers and labels; a written answer rarely matches word for word; a value hidden when the conversation was captured, such as an email or a long number kept as [redacted:email], cannot be checked, so an answer that matches everywhere else still scores 0 and says so). An exact benchmark needs a right answer on every conversation: 422 BENCHMARK_ROW_HAS_NO_ANSWER names the ones without and nothing is saved -- mark their answers good or correct them first, leave them out, or use 'judge'. It is refused rather than trimmed when a conversation has nothing to ask a model, or is too large to keep in storage: 422 BENCHMARK_ROW_UNUSABLE names it, and nothing is saved -- leave it out. 409 CONFLICT when the conversations could not be stored just then: nothing was saved; try again in a minute. Attach it with loop_attach_pipeline_benchmark.", {
3534
- name: z.string(),
3546
+ name: z.string().describe("Display name for the benchmark being created."),
3535
3547
  source: z.object({
3536
3548
  kind: z.enum(["traces"]).describe("Always 'traces': a benchmark pins the conversations named in trace_ids"),
3537
3549
  trace_ids: z.array(z.string()).min(1).describe("The conversations to pin, 20 to 200 (from loop_list_traces, or the trace_ids loop_import_rows returns for a file)"),
3538
- }),
3550
+ }).describe("Saved samples supplying the benchmark's fixed questions and expected answers."),
3539
3551
  check: z.enum(["judge", "exact"]).optional().describe("How answers are scored: judge (the default: the judge reads both answers against the right answer) or exact (the answer or the tool call must match the right answer; no model is asked)"),
3540
3552
  }, async ({ name, source, check }) => json(await client.api("/api/loop/benchmarks", {
3541
3553
  method: "POST",
3542
3554
  body: { name, source, check },
3543
3555
  })));
3544
3556
  server.tool("loop_list_benchmarks", "The workspace's benchmarks, newest first. status 'active' hides the retired ones. Each carries check (how it is scored: judge, scored by the judge, or exact, the exact check with no model) and storage -- what its pinned set takes up in storage (bytes, objects, where: platform, your_storage or both, and billed); it counts toward the workspace's storage quota and is deleted with the workspace. A benchmark's pinned set is never billed: it is kept until the workspace is deleted, whatever is done with the benchmark, so billed is always false on it -- say it is not billed.", {
3545
- status: z.enum(["active", "retired"]).optional(),
3546
- limit: z.number().int().min(1).max(200).optional(),
3547
- offset: z.number().int().min(0).optional(),
3557
+ status: z.enum(["active", "retired"]).optional().describe("Include only active or retired workspace benchmarks."),
3558
+ limit: z.number().int().min(1).max(200).optional().describe("Maximum number of matching records to return on this page."),
3559
+ offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
3548
3560
  }, async ({ status, limit, offset }) => json(await client.api("/api/loop/benchmarks", {
3549
3561
  params: { status, limit: limit?.toString(), offset: offset?.toString() },
3550
3562
  })));
3551
- server.tool("loop_get_benchmark", "One benchmark: how it is scored (check: judge, scored by the judge, or exact, the exact check with no model -- then judge_model is empty), its frozen judge and scoring rule, the fingerprint of its set, and storage -- what its pinned set takes up in storage (bytes, objects, where: platform, your_storage or both, and billed). The set is kept in storage only; it counts toward the workspace's storage quota and is deleted with the workspace. A benchmark's pinned set is never billed: it is kept until the workspace is deleted, whatever is done with the benchmark, so billed is always false on it -- say it is not billed.", { benchmark_id: z.string() }, async ({ benchmark_id }) => json(await client.api(`/api/loop/benchmarks/${encodeURIComponent(benchmark_id)}`)));
3563
+ server.tool("loop_get_benchmark", "One benchmark: how it is scored (check: judge, scored by the judge, or exact, the exact check with no model -- then judge_model is empty), its frozen judge and scoring rule, the fingerprint of its set, and storage -- what its pinned set takes up in storage (bytes, objects, where: platform, your_storage or both, and billed). The set is kept in storage only; it counts toward the workspace's storage quota and is deleted with the workspace. A benchmark's pinned set is never billed: it is kept until the workspace is deleted, whatever is done with the benchmark, so billed is always false on it -- say it is not billed.", { benchmark_id: z.string().describe("Benchmark identifier returned by loop_list_benchmarks in this workspace.") }, async ({ benchmark_id }) => json(await client.api(`/api/loop/benchmarks/${encodeURIComponent(benchmark_id)}`)));
3552
3564
  server.tool("loop_list_benchmark_items", "The conversations a benchmark pinned, each with the right answer pinned with it (reference: answer, kind and tool_calls -- an answer marked good that only calls a tool has an empty answer and its calls; null when nobody gave one). A conversation deleted since keeps its pinned copy; its source link reads null.", {
3553
- benchmark_id: z.string(),
3565
+ benchmark_id: z.string().describe("Benchmark identifier returned by loop_list_benchmarks in this workspace."),
3554
3566
  limit: z.number().int().min(1).max(200).optional().describe("50 when omitted, at most 200"),
3555
- offset: z.number().int().min(0).optional(),
3567
+ offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
3556
3568
  }, async ({ benchmark_id, limit, offset }) => json(await client.api(`/api/loop/benchmarks/${encodeURIComponent(benchmark_id)}/items`, {
3557
3569
  params: { limit: limit?.toString(), offset: offset?.toString() },
3558
3570
  })));
3559
3571
  server.tool("loop_get_benchmark_history", "Every score a benchmark has produced, newest first: the trend line. Each point names the training number (attempt_no) of its pipeline it measured and the version that training became (null when it did not become one); name points by those ('training #6, v5'), never by run_seq, which counts every benchmark run in the workspace. A benchmark run that could not score the whole set has null scores and a status_reason — report the reason, never a number for it. pipeline keeps only the points of one pipeline's trainings, so the trend reads by training number; without it the points of every pipeline using the benchmark are mixed.", {
3560
- benchmark_id: z.string(),
3572
+ benchmark_id: z.string().describe("Benchmark identifier returned by loop_list_benchmarks in this workspace."),
3561
3573
  pipeline: z.string().optional().describe("Only this pipeline's trainings (its id, from loop_list_pipelines)"),
3562
- limit: z.number().int().min(1).max(200).optional(),
3563
- offset: z.number().int().min(0).optional(),
3574
+ limit: z.number().int().min(1).max(200).optional().describe("Maximum number of matching records to return on this page."),
3575
+ offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
3564
3576
  }, async ({ benchmark_id, pipeline, limit, offset }) => json(await client.api(`/api/loop/benchmarks/${encodeURIComponent(benchmark_id)}/history`, {
3565
3577
  params: { pipeline: pipeline || undefined, limit: limit?.toString(), offset: offset?.toString() },
3566
3578
  })));
3567
3579
  server.tool("loop_retire_benchmark", "Stop testing on a benchmark and detach it from every pipeline. Nothing it measured is removed, and its name is free for a successor. It cannot be un-retired; confirm first.", {
3568
- benchmark_id: z.string(),
3569
- reason: z.string().optional(),
3580
+ benchmark_id: z.string().describe("Benchmark identifier returned by loop_list_benchmarks in this workspace."),
3581
+ reason: z.string().optional().describe("Human-readable reason to record for retiring this benchmark."),
3570
3582
  }, async ({ benchmark_id, reason }) => json(await client.api(`/api/loop/benchmarks/${encodeURIComponent(benchmark_id)}/retire`, {
3571
3583
  method: "POST",
3572
3584
  body: { reason },
3573
3585
  })));
3574
- server.tool("loop_get_benchmark_run", "One benchmark run in full (one training tested on one benchmark): both scores, the difference, the per-dimension breakdown, how many questions each side passed (score 0.70 or more) and the pass rates, the questions the new model did better, worse and the same on (wins, losses, ties), learned_by_version (how many of these conversations the version under test learned -- trained on itself or learned by a version it was built on; when it is above 0, say \"N of these conversations were learned by this version\", since its score on them is partly recall; null for a version from before versions built on each other: say nothing then), and what it cost. Read status first — a benchmark run that did not score every pinned question publishes no score, and its pass counts, rates and wins are null too. loop_list_benchmark_run_items reads every conversation behind it.", { benchmark_run_id: z.string() }, async ({ benchmark_run_id }) => json(await client.api(`/api/loop/benchmark-runs/${encodeURIComponent(benchmark_run_id)}`)));
3586
+ server.tool("loop_get_benchmark_run", "One benchmark run in full (one training tested on one benchmark): both scores, the difference, the per-dimension breakdown, how many questions each side passed (score 0.70 or more) and the pass rates, the questions the new model did better, worse and the same on (wins, losses, ties), learned_by_version (how many of these conversations the version under test learned -- trained on itself or learned by a version it was built on; when it is above 0, say \"N of these conversations were learned by this version\", since its score on them is partly recall; null for a version from before versions built on each other: say nothing then), and what it cost. Read status first — a benchmark run that did not score every pinned question publishes no score, and its pass counts, rates and wins are null too. loop_list_benchmark_run_items reads every conversation behind it.", { benchmark_run_id: z.string().describe("Identifier of the benchmark run whose scores should be inspected.") }, async ({ benchmark_run_id }) => json(await client.api(`/api/loop/benchmark-runs/${encodeURIComponent(benchmark_run_id)}`)));
3575
3587
  server.tool("loop_benchmark_questions", "Every question of a benchmark with how one pipeline's recent trainings did on it. trainings lists them oldest first ('attempt' is the training's number, version the version it became or null, status its benchmark result's status: anything but done scored only some questions), and each question's results follow that order with passed (right: a score of 0.70 or more) and score, both null where that training did not score the question. Use it to find the questions a new version got wrong that the one before got right, and say them by question, not by id. It writes nothing.", {
3576
3588
  benchmark_id: z.string().describe("The benchmark's id, from loop_list_benchmarks or loop_list_pipeline_benchmarks"),
3577
3589
  pipeline: z.string().describe("The pipeline whose trainings to show (its id, from loop_list_pipelines): training numbers are per pipeline"),
3578
3590
  trainings: z.number().int().min(1).max(20).optional().describe("How many of its recent trainings, 5 when absent, at most 20"),
3579
3591
  limit: z.number().int().min(1).max(200).optional().describe("Questions per page, 50 when absent, at most 200"),
3580
- offset: z.number().int().min(0).optional(),
3592
+ offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
3581
3593
  }, async ({ benchmark_id, pipeline, trainings, limit, offset }) => json(await client.api(`/api/loop/benchmarks/${encodeURIComponent(benchmark_id)}/questions`, {
3582
3594
  params: { pipeline, trainings: trainings?.toString(), limit: limit?.toString(), offset: offset?.toString() },
3583
3595
  })));
@@ -3587,11 +3599,11 @@ create (1-5 choices), and the queue itself stays opt-in.`,
3587
3599
  candidate_passed: z.boolean().optional().describe("true: only questions where the new model's answer passed (score 0.70 or more); false: only ones where it was scored below 0.70. With incumbent_passed it narrows to one cell: candidate_passed false and incumbent_passed true are the ones that got worse. One that could not be scored matches neither"),
3588
3600
  incumbent_passed: z.boolean().optional().describe("true: only questions where the live version's answer passed (score 0.70 or more); false: only ones where it was scored below 0.70"),
3589
3601
  has_reference: z.boolean().optional().describe("Only conversations with (true) or without (false) a right answer"),
3590
- status: z.enum(["scored", "failed"]).optional(),
3602
+ status: z.enum(["scored", "failed"]).optional().describe("Filter benchmark items by scoring outcome."),
3591
3603
  sort: z.enum(["ordinal", "score_change"]).optional().describe("score_change: the new model's score less the live version's, largest first"),
3592
3604
  q: z.string().min(2).max(200).optional().describe("Search the conversation (not the system prompt every question shares), the right answer, both answers and every reason (case-insensitive); searched in the answer says how many were read. A search can be refused 429 RATE_LIMITED while this workspace already has a search running or while the service is running as many searches as it can at once, so a 429 does not say which: never tell the user they already had one running; try again after the seconds its message gives"),
3593
3605
  limit: z.number().int().min(1).max(200).optional().describe("50 when omitted, at most 200"),
3594
- offset: z.number().int().min(0).optional(),
3606
+ offset: z.number().int().min(0).optional().describe("Number of matching records to skip. Use the continuation offset when the previous result supplies one."),
3595
3607
  }, async ({ benchmark_run_id, winner, candidate_passed, incumbent_passed, has_reference, status, sort, q, limit, offset }) => json(await client.api(`/api/loop/benchmark-runs/${encodeURIComponent(benchmark_run_id)}/items`, {
3596
3608
  params: { winner, candidate_passed: candidate_passed?.toString(), incumbent_passed: incumbent_passed?.toString(), has_reference: has_reference?.toString(), status, sort, q, limit: limit?.toString(), offset: offset?.toString() },
3597
3609
  })));