@toloka-platform/sdk 0.2.0-preview.3 → 0.2.0

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.
Files changed (75) hide show
  1. package/README.md +5 -6
  2. package/dist/cli/toloka.js +136 -136
  3. package/dist/cli/toloka.js.jsc +0 -0
  4. package/dist/cli/toloka.js.jsc.sha256 +1 -1
  5. package/dist/cli/toloka.js.sha256 +1 -1
  6. package/docs/cli-v2.md +3 -2
  7. package/docs/cli.md +35 -7
  8. package/docs/getting-started.md +4 -2
  9. package/docs/limitations.md +2 -2
  10. package/openapi/gen/models/baseModel.ts +1 -0
  11. package/openapi/gen/models/currentUser.ts +2 -0
  12. package/openapi/gen/models/currentUserTeamsItem.ts +6 -0
  13. package/openapi/gen/models/gistingTrainingConfiguration.ts +6 -2
  14. package/openapi/gen/models/gistingTrainingConfigurationBatchSize.ts +2 -0
  15. package/openapi/gen/models/gistingTrainingConfigurationGistTokens.ts +2 -0
  16. package/openapi/gen/models/gistingTrainingConfigurationInput.ts +6 -2
  17. package/openapi/gen/models/gistingTrainingConfigurationInputBatchSize.ts +2 -0
  18. package/openapi/gen/models/gistingTrainingConfigurationInputGistTokens.ts +2 -0
  19. package/openapi/gen/models/index.ts +9 -4
  20. package/openapi/gen/models/sftTrainingConfiguration.ts +6 -3
  21. package/openapi/gen/models/sftTrainingConfigurationBatchSize.ts +2 -0
  22. package/openapi/gen/models/sftTrainingConfigurationInput.ts +6 -3
  23. package/openapi/gen/models/sftTrainingConfigurationInputBatchSize.ts +2 -0
  24. package/openapi/gen/models/sftTrainingConfigurationInputLoraRank.ts +2 -0
  25. package/openapi/gen/models/sftTrainingConfigurationLoraRank.ts +2 -0
  26. package/package.json +2 -2
  27. package/skills/catalog.json +11 -11
  28. package/skills/toloka-build/SKILL.md +29 -18
  29. package/skills/toloka-build/references/node-semantics.md +7 -7
  30. package/skills/toloka-build/references/workflow-and-cli.md +15 -12
  31. package/skills/toloka-fine-tuning/SKILL.md +145 -62
  32. package/skills/toloka-get-started/SKILL.md +37 -21
  33. package/skills/toloka-gisting/SKILL.md +156 -66
  34. package/skills/toloka-report-issue/references/report-template.md +1 -1
  35. package/src/cli/analytics.ts +50 -23
  36. package/src/cli/auth.ts +31 -12
  37. package/src/cli/auto-update.ts +12 -6
  38. package/src/cli/check.ts +76 -29
  39. package/src/cli/cli-entry.ts +3 -2
  40. package/src/cli/cli-error.ts +43 -0
  41. package/src/cli/commands/dataset.ts +13 -3
  42. package/src/cli/commands/models.ts +6 -7
  43. package/src/cli/commands/pipeline.ts +6 -7
  44. package/src/cli/commands/project.ts +9 -16
  45. package/src/cli/commands/report.ts +6 -2
  46. package/src/cli/commands/secret.ts +5 -4
  47. package/src/cli/commands/source.ts +4 -4
  48. package/src/cli/commands/status.ts +2 -3
  49. package/src/cli/commands/training.ts +50 -17
  50. package/src/cli/config.ts +2 -2
  51. package/src/cli/context.ts +55 -17
  52. package/src/cli/credentials.ts +12 -4
  53. package/src/cli/data.ts +96 -34
  54. package/src/cli/delivery-orders.ts +18 -1
  55. package/src/cli/file-system.ts +6 -2
  56. package/src/cli/format-error.ts +45 -2
  57. package/src/cli/init.ts +13 -7
  58. package/src/cli/models.ts +43 -12
  59. package/src/cli/program.ts +5 -56
  60. package/src/cli/project-context.ts +117 -32
  61. package/src/cli/project.ts +80 -28
  62. package/src/cli/report.ts +24 -9
  63. package/src/cli/runs.ts +33 -8
  64. package/src/cli/settings.ts +13 -5
  65. package/src/cli/skill.ts +61 -22
  66. package/src/cli/source.ts +3 -2
  67. package/src/cli/terminal-io.ts +13 -6
  68. package/src/cli/trainings.ts +129 -35
  69. package/src/cli/version.ts +2 -2
  70. package/src/client.ts +3 -9
  71. package/src/transport.ts +13 -1
  72. package/openapi/gen/models/gistingTrainingConfigurationInputRegime.ts +0 -2
  73. package/openapi/gen/models/gistingTrainingConfigurationRegime.ts +0 -2
  74. package/openapi/gen/models/sftTrainingConfigurationInputRegime.ts +0 -2
  75. package/openapi/gen/models/sftTrainingConfigurationRegime.ts +0 -2
@@ -5,18 +5,27 @@ description: Build, test, inspect, or change Toloka platform pipeline projects a
5
5
 
6
6
  # Build Toloka pipelines as code
7
7
 
8
- This SDK is Beta software. The authoring API, the CLI, and generated source can change before general availability. Do not invent helpers or flags that are not in the installed package.
8
+ This SDK follows `0.x` versioning, so the authoring API, the CLI, and generated source can change between releases. Use the API and commands exposed by the installed package; do not invent helpers or flags.
9
9
 
10
- Use this skill when the user has selected pipeline authoring or wants to create, inspect, test, or change a Toloka pipeline project as code. Work in the project source tree; do not translate the request into direct platform API calls.
10
+ Help the user get a working pipeline that fits their task: understand the data and desired output, choose a suitable design, verify it, and apply or run it when requested. Work in the project source tree; TypeScript is the pipeline's desired state, not a transcription of direct platform API calls.
11
11
 
12
12
  ## Enter the pipeline workflow
13
13
 
14
- When a user is new to Toloka or has not selected a workflow, run `toloka skill install toloka-get-started`, read `.agents/skills/toloka-get-started/SKILL.md`, and follow the matching public runbook first. This skill starts after pipeline work is selected and owns pipeline authoring semantics, local tests, recovery, and evidence reporting.
14
+ For first-time setup or help choosing a workflow, install and read `toloka-get-started` and consult the matching public runbook. Use its onboarding steps where needed; an existing project or a focused inspection request does not need the full first-run journey. A demo is useful for learning, not a prerequisite for the user's own task.
15
15
 
16
- Do not replace the selected runbook's quick demo with another example, and do not run the demo when the user chooses their own task. Never cross its API-key, project-creation, plan, or run-cost checkpoint without the user's required action or approval.
16
+ Use your expertise for routine choices, and briefly explain decisions that affect quality, cost, or maintainability. Ask a focused question when missing requirements or conflicting constraints would materially change the result; do not ask the user to choose SDK mechanics you can determine yourself. Preserve explicit requirements and existing project intent. Credentials belong in the user's `toloka login` prompt, paid runs need cost approval, and destructive or out-of-scope changes need agreement before proceeding.
17
+
18
+ ## Choose a design that fits the task
19
+
20
+ - Start with representative inputs and the output the user needs. Reuse an existing pipeline or node when it already serves that purpose; prefer the simplest graph that meets the requirements.
21
+ - Use `code` for deterministic transformations, scripts, or programmatic API/LLM calls; `generation` for the platform's human or synthetic generation journey, including original content collection; `quorum` for independent annotations where agreement or disagreement matters; and `match` for conditional routing. `root` defines the input/output boundary.
22
+ - Choose data contracts, audience, instructions, and quality criteria together: the person doing the task should be able to produce the declared output and understand how it will be judged. Let the task and observed data guide these choices rather than copying an example's settings.
23
+ - Treat quality, turnaround, and cost as tradeoffs. Explain meaningful assumptions, and seek clarification for unresolved acceptance criteria rather than inventing business rules. Read [node semantics](references/node-semantics.md) for each selected node's actual capabilities and constraints.
17
24
 
18
25
  ## Follow the reconciliation loop
19
26
 
27
+ For an applied change, the dependencies are read → edit → check/validate → plan → apply → confirm convergence. Iterate locally as needed. For inspection, design, or check-only requests, stop at the requested deliverable rather than creating resources, applying changes, or starting a run merely to finish this sequence.
28
+
20
29
  1. Read `toloka.json` when present, then read the relevant `pipelines/**/pipeline.ts` module and everything it imports.
21
30
  2. Edit the TypeScript source. Treat it as authoritative desired state.
22
31
  3. Run the complete local gate, then validate each changed pipeline against the platform:
@@ -25,7 +34,7 @@ Do not replace the selected runbook's quick demo with another example, and do no
25
34
  toloka validate
26
35
  ```
27
36
  4. Run `toloka plan`. Read the complete diff and resolve every conflict or missing prerequisite.
28
- 5. Run `toloka apply`. Apply reruns the complete local gate and proceeds only when it passes. Apply only after the plan matches the request.
37
+ 5. Show the plan and run `toloka apply` when its changes match the requested work. Resolve removals, immutable-field conflicts, or changes outside that scope with the user first. Apply reruns the complete local gate and proceeds only when it passes.
29
38
  6. Run `toloka plan` again and require `No changes.`
30
39
 
31
40
  The CLI reads source, compares it with live state, and reconciles the platform. Edit files; never mutate a pipeline through raw HTTP, SDK client methods, or internal platform tool calls. Do not make a live edit and then reverse-engineer it into source.
@@ -37,13 +46,15 @@ Use the directory containing `toloka.json` as the source root. Commands default
37
46
  - If `toloka.json` exists, read it as CLI-managed identity state and confirm its `projectId` matches `toloka project current` before any plan or apply. It maps the project, pipeline source directories, and dataset names to live IDs. Do not hand-edit it.
38
47
  - If it is absent and the user is adopting an existing project, run `toloka project add <alias> <projectId>`, then run `toloka import <projectId>` in the intended source root before `toloka init`. Import refuses an existing `pipelines/` directory unless you pass `--force`.
39
48
  - After importing an existing project, run `toloka plan` before editing and require `No changes.`. Resolve importer or live-state drift separately so it cannot be mistaken for your change.
40
- - If it is absent and the user is authoring from scratch, run `toloka project create <alias>` before `toloka init`. Confirm `toloka project current` and the generated `toloka.json` name the new project before authoring.
49
+ - If it is absent and the user is authoring from scratch, create a project with a task-derived name when a new project is needed. For an intended existing empty project, use `toloka project add <alias> <projectId>` and `toloka --project-id <projectId> init`. Confirm `toloka project current` and the generated `toloka.json` name the intended project before authoring; do not create a duplicate merely because the checkout is unbound.
41
50
 
42
51
  If `toloka project current` reports `from toloka.json` for a project you did not select in this checkout, stop: project create/add/switch does not rebind an existing checkout. A newly generated state file with empty `pipelines` and `datasets` can be removed before selecting the intended project and rerunning `toloka init`; any state file with live bindings may be someone else's checkout and must not be deleted without user approval.
43
52
 
44
53
  Never assume a project ID from conversation context. Resolve it from `--project-id`, `TOLOKA_PROJECT_ID`, `toloka.json`, or `toloka project current`.
45
54
 
46
- `project create`, `project add`, and `project switch` also change the machine-level current-project registry used outside a source root. For temporary or evaluation projects, record the previous alias and restore it before finishing. If create requires `--team-id`, use the team from `toloka status --project-id <authorized-project>` only when that project is known to share the intended owner; state the assumption and confirm the new project's team in `toloka project url`. With no such project, ask the user for the team ID.
55
+ An unverified trial account holds one project and one pipeline, and cannot deploy or run. `project create` then fails with `Your trial allows a single project.` and pipeline creation with `Your trial allows a single pipeline.` Adopt the project that already exists instead: register it with `toloka project add <alias> <projectId>`, bind the checkout with `toloka import <projectId>`, and author inside its existing pipeline; the platform has no project delete, so there is nothing to clear. Both limits lift when the user completes identity or business verification from the banner in the platform.
56
+
57
+ `project create`, `project add`, and `project switch` also change the machine-level current-project registry used outside a source root. For temporary or evaluation projects, record the previous alias and restore it before finishing. Without `--team-id`, create uses the account's only writable team; when `toloka whoami` lists several teams, ask the user which one owns the project and pass it explicitly. Confirm the new project's team in `toloka project url`.
47
58
 
48
59
  ## Author with the typed graph API
49
60
 
@@ -51,23 +62,23 @@ Import authoring helpers from `@toloka-platform/sdk`.
51
62
 
52
63
  - Declare every data contract once with `field(name, jsonSchema)`.
53
64
  - Decide entity cardinality from the task before choosing field schemas or Task UI components. One logical output from one labeler is a static entity, even when a component represents it with an array; only multiple independent outputs are dynamic. For dynamic entities, choose a tight task-grounded `maxEntities` instead of defaulting to 50.
54
- - Do not invent enum, length, range, format, label-precedence, tie-break, default, exact-phrase, or conditional-requiredness rules absent from the request or observed data. Before apply, list every authored rule the request did not fix—including criteria, quiz answers, and UI validation—as an assumption; choose the least surprising option and carry that list into the final report.
55
- - Use exactly these constructors: `root`, `code`, `generation`, `match`, and `quorum`.
65
+ - Ground enum, length, range, format, label-precedence, tie-break, default, exact-phrase, and conditional-requiredness rules in the request, observed data, or documented platform requirements. Derive criteria, quiz answers, and UI validation from that evidence. Surface assumptions that affect accepted outputs before apply; if materially different interpretations remain, ask instead of silently deciding the user's business rules.
66
+ - The supported node constructors are `root`, `code`, `generation`, `match`, and `quorum`.
56
67
  - Connect typed ports with `connect(from, to)`: `started`, `completed`, `input`, `output`, `matchNode.matched(0)`, and `default`.
57
68
  - Export a default `definePipeline({ dataset, fields, nodes, connections })` from every `pipelines/**/pipeline.ts`.
58
69
  - Keep the graph acyclic. Put review, retry, training, exam, appeal, and payment behavior in the owning human-work node rather than adding loop nodes.
59
70
 
60
71
  Let constructors mint IDs for new declarations. Preserve `id` options generated by `toloka import`, but never invent or hand-edit raw `fp_…`, `ds.…`, `pl.…`, or `pp.…` values in authored settings. Never add a `layout` block: layout is not authored, existing layout is preserved, and the server supplies defaults.
61
72
 
62
- Read [node semantics](references/node-semantics.md) before selecting or configuring a node. Use `node_modules/@toloka-platform/sdk/examples/face-image-collection/` as a concrete authoring pattern.
73
+ Use `node_modules/@toloka-platform/sdk/examples/face-image-collection/` as a concrete authoring pattern when relevant; borrow its structure, not its task-specific choices.
63
74
 
64
75
  ## Get human-work settings right the first time
65
76
 
66
- These are server rules that `definePipeline` does not check. Each one costs an apply or a failed deployment to discover.
77
+ Distinguish server requirements from optional design choices. The following constraints and defaults are not all checked by `definePipeline`:
67
78
 
68
79
  - **Do not pair `projectType: 'general'` with `verifiedExperts: false`.** The server answers `General projects require an ID-verified audience`. Specializations also require a verified audience.
69
80
  - **Training is part of the node, not extra.** A quorum node requires `onboarding`, and while it is enabled the platform wants at least three steps and at least one quiz block. Preserve an explicit `enabled: false` that a user or `toloka import` put there; never switch Training on to satisfy your own sense of completeness.
70
- - **Do not author placeholder optional settings.** Omit `exam`, non-default QA, audience reuse, and smart-search blocks unless the user requested them or imported source already controls them. An empty disabled block is still authored state.
81
+ - **Optional settings should serve the task.** Exams, non-default QA, audience reuse, and smart search can be useful when the requirements call for them. Omit blocks that add no value rather than copying placeholders; an empty disabled block is still authored state. Preserve imported choices unless changing them is part of the task, and explain additions that affect cost or expert eligibility.
71
82
  - **Run scope belongs to the platform.** `itemFilter` and `itemLimit` on the root node are set from the platform, and apply preserves whatever is live unless source declares its own value. Do not add an item limit to source to "restore" one you saw in the UI.
72
83
 
73
84
  ## Know the validation boundary
@@ -82,7 +93,7 @@ Before choosing Task UI components, call `ui.componentDocumentation()` from a lo
82
93
 
83
94
  `ui.code` accepts TSX, including TypeScript annotations. `preprocess` and `postprocess` are JavaScript function bodies; do not put TypeScript-only syntax in either transform.
84
95
 
85
- Register code behavior with `test.code(pipeline, node, name, callback)` and execute the bound `run` helper. Add at least one `test.pipeline(pipeline, name, callback)` scenario. When a local dataset file is available, use its first row as the initial item state; redact sensitive values while preserving field names, nesting, optionality, and media/value shapes. Use synthetic input only when no local row exists. Treat the fixture as `root.started` item state, execute connected nodes in order with the callback's bound code and UI helpers, merge only each node's declared outputs, and assert the final `root.completed` fields. One scenario is appropriate for a linear happy path; use separate scenarios for different match branches, optional paths, and failures.
96
+ Register code behavior with `test.code(pipeline, node, name, callback)` and execute the bound `run` helper. Add at least one `test.pipeline(pipeline, name, callback)` scenario. Choose representative fixtures from available data, redacting sensitive values while preserving field names, nesting, optionality, and media/value shapes. Use synthetic cases when needed for privacy or to exercise boundaries absent from the sample. Treat the fixture as `root.started` item state, execute connected nodes in order with the callback's bound code and UI helpers, merge only each node's declared outputs, and assert the final `root.completed` fields. Cover meaningful match branches, optional paths, and failures as well as the happy path.
86
97
 
87
98
  ## Keep data and credentials out of source
88
99
 
@@ -94,7 +105,7 @@ Register code behavior with `test.code(pipeline, node, name, callback)` and exec
94
105
  `toloka login` verifies an API key and stores it with owner-only permissions, so no later command needs
95
106
  `--api-key`. Precedence is flag, then environment variable (`TOLOKA_API_KEY`, `TOLOKA_BASE_URL`), then
96
107
  that file. `toloka auth-status` reports what is in effect and where it came from; `toloka logout`
97
- removes it. If a command reports missing credentials, run `toloka login`; never invent a key.
108
+ removes it. If credentials are missing, ask the user to run `toloka login` in their terminal; never request a key in chat.
98
109
  Anonymous command telemetry is on by default; set `TOLOKA_TELEMETRY=0` or `DO_NOT_TRACK=1` to disable it.
99
110
  A globally installed CLI auto-updates by default; turn that off with `toloka config set auto-update false`.
100
111
 
@@ -107,14 +118,14 @@ A globally installed CLI auto-updates by default; turn that off with `toloka con
107
118
 
108
119
  ## Run a deployed pipeline
109
120
 
110
- Before starting a run, require a passing `toloka check` and no blocking error from `toloka validate`. A warning-severity `not_ran_node_check` concerns a separate Remote Node Check and does not block the Local Check Gate; an error-severity instance remains a blocking remote-validation result. Run `toloka pipeline cost <name>` when pricing evidence is needed; if it skips a billed node, report the authored rate and a labeled labor floor instead of presenting `$0.00` as the price.
121
+ Before starting a run, require a passing `toloka check` and no blocking error from `toloka validate`. A warning-severity `not_ran_node_check` concerns a separate Remote Node Check and does not block the Local Check Gate; an error-severity instance remains a blocking remote-validation result. Run `toloka pipeline cost <name>` and present the forecast for user approval before starting the run. If it skips a billed node, report the authored rate and a labeled labor floor instead of presenting `$0.00` as the price; make the missing pricing evidence clear when seeking approval.
111
122
 
112
123
  Start a run with `toloka pipeline run <name> --wait --timeout <ms>`, then read its exit code: `0` succeeded, `1` reached a failed terminal state, `2` still running when the window closed. Without `--wait`, exit `0` only means the run was accepted. Nothing reports back later, so never describe a started run as a finished one. Name the live pipeline; there is no implicit only-pipeline.
113
124
 
114
- Always bound the wait. A queue with no one working it stays in progress indefinitely, so an unbounded poll loop ends with you killed and reporting nothing. On exit `2`, stop waiting and report what you observed: item counts, current states, and that the run had not finished. A bounded honest report beats an unbounded silent wait. Use `toloka pipeline status <name>` and `toloka pipeline results <runId> --failed` for counts, states, and errors. `toloka status` (no prefix) is project health, not the latest run.
125
+ Keep monitoring bounded so the user receives a useful update even when expert work or queues take time. On exit `2`, report the observed item counts and states and say the run is still in progress; choose a further bounded check only when it serves the request. Use `toloka pipeline status <name>` and `toloka pipeline results <runId> --failed` for counts, states, and errors. `toloka status` (no prefix) is project health, not the latest run.
115
126
 
116
127
  ## Report with evidence
117
128
 
118
- Deliver that report in the same reply that does the work. There is no later turn and no background poller that will speak for you: if you end by promising to report once a window closes, the observation is lost and the work counts for nothing. Poll in the foreground, then state what you saw before you finish.
129
+ Explain what changed, how it meets the task, what you verified, and what remains unresolved. Include relevant project/pipeline links, meaningful design assumptions, and observed run state and cost. Distinguish applied, validated, started, and completed; do not promise a later update unless a real reporting mechanism exists.
119
130
 
120
- For an autonomous or audited platform change, save stdout, stderr, and exit status for skill discovery and every networked mutation, check, and project-registry change outside authored source, then cite those records for counts, exit codes, and convergence claims. If skill installation fails, record the failure and identify the exact skill path and version or digest followed instead. Every reported defect or guidance gap must cite a saved record or be labeled `unrecorded`; mark recurrences from earlier work. Classify each as a skill rule, a rule present but not followed, a documentation gap, or a CLI/platform defect; use the bundled `toloka-report-issue` skill for product defects instead of teaching a workaround as normal workflow. Report every authored rule not fixed by the request as an assumption. For visual evidence, list every saved screenshot as inspected or uninspected and limit appearance claims to the inspected set.
131
+ Keep enough command output and exit-status evidence to support claims about checks, mutations, and convergence, redacting secrets and sensitive data. For an audited task, retain the requested detailed records, including skill versions and project-registry changes. State when evidence is missing, and limit visual claims to surfaces you actually inspected. Use `toloka-report-issue` for product defects rather than presenting a workaround as normal workflow.
@@ -68,7 +68,7 @@ The dataset name belongs in `definePipeline({ dataset: 'name', ... })`, not in t
68
68
 
69
69
  Use `code` whenever the result can be computed from inputs without a human task. This includes deterministic transforms, ETL, filtering, parsing, arithmetic, string manipulation, scripts, HTTP APIs, and LLM API calls. An LLM call made programmatically is still `code`; choose `generation` only when the platform's human or synthetic generation journey is wanted.
70
70
 
71
- Use a downstream `code` node after `quorum` only when the user asks for a derived consensus value such as majority vote, average, or deduplication. Quorum itself returns raw collected annotations.
71
+ Use a downstream `code` node after `quorum` when the requested deliverable needs a derived consensus value such as majority vote, average, or deduplication. Quorum itself returns raw collected annotations. Choose an aggregation rule grounded in the task, and clarify material ambiguity rather than inventing label precedence.
72
72
 
73
73
  ### Configure it
74
74
 
@@ -158,17 +158,17 @@ Write at least one criterion for every output entity. Each criterion needs an au
158
158
 
159
159
  Use `llmQaInstruction` only when the evaluator needs a specific verification method, authoritative source, tool, or pinned edge case beyond the thresholds. It is evaluator guidance, not labeler guidance, and has no effect in `human_only` mode.
160
160
 
161
- Default QA is `qualityAssurance: { qaMode: 'llm_only' }`. Do not ask whether QA is wanted. Use `hybrid` only when the user explicitly requests human review; it adds sampled Human QA while retaining LLM review. Use `human_only` only when the user explicitly prohibits LLM grading. Human-bearing modes require `humanQaTimeForTask` of at least 10 seconds; omit `smartSamplingPercent` for the platform defaults of 30 for hybrid and 100 for human-only unless the user asks for another rate. QA mode applies to the whole node, not individual criteria. The redo cap is platform-controlled and is not an SDK setting.
161
+ Default QA is `qualityAssurance: { qaMode: 'llm_only' }`. Keep it when it fits the task. `hybrid` adds sampled Human QA while retaining LLM review; `human_only` is appropriate when LLM grading is prohibited or human review alone is required. Recommend a mode based on the user's quality and privacy requirements, explaining cost and turnaround implications before changing it. Human-bearing modes require `humanQaTimeForTask` of at least 10 seconds; `smartSamplingPercent` defaults to 30 for hybrid and 100 for human-only. Use those defaults unless the task justifies a different rate. QA mode applies to the whole node, not individual criteria. The redo cap is platform-controlled and is not an SDK setting.
162
162
 
163
163
  Keep `instruction` actionable and in English. Include the workflow, concepts, quality rules, and at least one pass and fail example grounded in the task. Do not mention project schedules, dataset volume, workforce requirements, or compensation in labeler instructions.
164
164
 
165
165
  #### Audience and pricing
166
166
 
167
- For humans, set `audienceType: 'human'`, `verifiedExperts`, all three audience filters, `pricePerTask`, and `timeForTask`. The public shapes differ by filter: languages use `{ type: 'and' | 'or', values: [{ value: 'English' }] }`; specializations use `{ type: 'and' | 'or', values: [{ value, qualificationId }] }`; countries use ISO 3166-1 alpha-2 codes, for example `{ type: 'or', values: ['US'] }`. Verify every country value matches `/^[A-Z]{2}$/`; apply currently accepts arbitrary strings that can match no experts. Start unspecified filters with English, no specializations, and no countries. Do not put specializations on an unverified audience. A specialization's `qualificationId` is platform identity: preserve an imported value, and do not invent one when the SDK cannot discover it.
167
+ For humans, set `audienceType: 'human'`, `verifiedExperts`, all three audience filters, `pricePerTask`, and `timeForTask`. The public shapes differ by filter: languages use `{ type: 'and' | 'or', values: [{ value: 'English' }] }`; specializations use `{ type: 'and' | 'or', values: [{ value, qualificationId }] }`; countries use ISO 3166-1 alpha-2 codes, for example `{ type: 'or', values: ['US'] }`. Verify every country value matches `/^[A-Z]{2}$/`; apply currently accepts arbitrary strings that can match no experts. Derive languages and expertise from the task and its inputs, leaving specialization and country filters unrestricted unless needed. English is a reasonable starting language for an English-language task, not a universal audience default. Ask when an unresolved audience requirement changes who can do the work. Do not put specializations on an unverified audience. A specialization's `qualificationId` is platform identity: preserve an imported value, and do not invent one when the SDK cannot discover it.
168
168
 
169
- Start with `$0.20` and 120 seconds when the task gives no stronger signal, then change them only for an explicit rate or clearly longer work. The per-expert cap is normally off. For `data_collection`, use a cap of 50 by default; use 1 for one-response-per-expert collection.
169
+ `$0.20` and 120 seconds are a starting point for a short task, not a universal rate. Estimate effort from the work and required expertise, respect explicit rates, and explain meaningful adjustments in the cost forecast. The per-expert cap is normally off. For collection tasks, choose a cap based on contributor diversity and repetition requirements; 1 fits one-response-per-expert collection. Avoid copying an arbitrary cap into a task that does not need one.
170
170
 
171
- Use `audienceType: 'synthetic'` only when the user explicitly asks for synthetic or model-generated data. Set the required `maxCostPerAttempt`, the per-attempt ceiling in charged US dollars across fresh input, cached input, and output together, and configure the optional `generationModelId`, `reasoningEffort`, and `llmInstruction`; do not include human pricing or audience fields. Take `generationModelId` only from the union the SDK exports, and never invent an id; when the user names no model, omit the property and accept the platform default instead of guessing one. Synthetic generation is incompatible with `data_collection`, human QA, audience reuse, expert sourcing, and Training.
171
+ Choose `audienceType: 'synthetic'` when model-generated data serves the requested outcome; preserve an explicit requirement for human judgments or original human content. Explain the quality and cost tradeoff if recommending synthetic generation. Set the required `maxCostPerAttempt`, the per-attempt ceiling in charged US dollars across fresh input, cached input, and output together, and configure the optional `generationModelId`, `reasoningEffort`, and `llmInstruction`; do not include human pricing or audience fields. Take `generationModelId` only from the union the SDK exports. Use a supported model suited to the task when there is evidence for that choice, or omit the property to use the platform default; do not guess IDs or capabilities. Synthetic generation is incompatible with `data_collection`, human QA, audience reuse, expert sourcing, and Training.
172
172
 
173
173
  #### Training, Exam, UI, and advanced settings
174
174
 
@@ -218,7 +218,7 @@ Configure entities for one labeler's contribution, not for the outer array. A si
218
218
 
219
219
  When a quorum output entity is `optional: true`, its outer field's `items` schema must also accept `null`, for example `{ type: 'array', items: { type: ['string', 'null'] } }`. The platform reserves a null annotation slot when that labeler omits the value and rejects an optional entity backed by non-nullable items.
220
220
 
221
- Quorum does not aggregate. It writes all raw annotations back, including rejected ones. Add a downstream `code` node only when the user asks for one consensus value, and make it tolerate arrays longer than `overlap`.
221
+ Quorum does not aggregate. It writes all raw annotations back, including rejected ones. Add a downstream `code` node when the requested deliverable needs one consensus value, and make it tolerate arrays longer than `overlap`.
222
222
 
223
223
  #### Explanation-driven quality
224
224
 
@@ -232,7 +232,7 @@ Default to `qualityAssurance: { qaMode: 'llm_only' }`. The LLM accepts or reject
232
232
 
233
233
  **Quorum has no redo cycle.** A rejected annotation is never reopened or sent back to the same expert. Escalation adds a fresh annotation, and all collected annotations—accepted and rejected—remain in the output arrays. Hitting the cap with zero accepted annotations still returns the collected results.
234
234
 
235
- Use `qaMode: 'none'` only when the user explicitly asks for agreement-based quality control instead of LLM QA. Then:
235
+ Use `qaMode: 'none'` when agreement-based quality control fits the task better than LLM grading, explaining the tradeoff before changing an existing QA strategy. This mode requires:
236
236
 
237
237
  - set `overlap` to at least 3;
238
238
  - disable the per-expert cap;
@@ -26,12 +26,12 @@ Treat the three layers differently:
26
26
 
27
27
  ## Initialize the source root
28
28
 
29
- For a first-time guided session, read `https://platform.toloka.ai/agents/data-labeling.md` first. Keep its stage order and checkpoints; use this reference for the commands and source-first invariants inside those stages.
29
+ For a first-time guided session, consult `https://platform.toloka.ai/agents/data-labeling.md` for orientation. Adapt the journey to the user's goal and already-complete setup while preserving dependencies, cost approval, and identity/source protection; use this reference for command details.
30
30
 
31
31
  Install the SDK before invoking project commands:
32
32
 
33
33
  ```sh
34
- bun add --dev @toloka-platform/sdk
34
+ bun add --dev @toloka-platform/sdk@latest
35
35
  ```
36
36
 
37
37
  Select or create the intended platform project before `toloka init` when the checkout should be bound immediately; follow the adoption or scratch recipe below. Running `init` without explicit or checkout-local project identity installs only the agent entry points and never adopts the machine registry's current project.
@@ -114,6 +114,7 @@ toloka apply
114
114
  toloka status
115
115
  toloka secret set <name> [--from-env <variable>]
116
116
  toloka dataset list
117
+ toloka dataset create <name>
117
118
  toloka dataset fields <name>
118
119
  toloka dataset load <name> --out <file> [--limit <n>] [--timeout <ms>]
119
120
  toloka dataset upload <name> <file>
@@ -133,8 +134,8 @@ toloka model create <name> --base <base-model-id> [--description <text>] [--json
133
134
  toloka model archive <name-or-id> [--json]
134
135
  toloka training list [--json]
135
136
  toloka training get <name-or-id> [--json]
136
- toloka training create <name> (--base-model <id> | --model-version <id>) --dataset <id> [--json]
137
- toloka training update <name-or-id> [configuration flags] [--json]
137
+ toloka training create <name> [--method sft|gisting] (--base-model <id> | --model-version <id>) --dataset <id> [--train-filter field=value] [--validation-dataset <id> [--validation-filter field=value]] [--prompt-file <path>] [--lora-rank 8|16|32 | --gist-tokens 8|32|64] [--epochs 1..5] [--learning-rate <rate>] [--batch-size 8|16|32|64] [--max-sequence-length <tokens>] [--json]
138
+ toloka training update <name-or-id> [--base-model <id> | --model-version <id>] [--dataset <id>] [--train-filter field=value] [--validation-dataset <id> [--validation-filter field=value]] [--prompt-file <path>] [--lora-rank 8|16|32 | --gist-tokens 8|32|64] [--epochs 1..5] [--learning-rate <rate>] [--batch-size 8|16|32|64] [--max-sequence-length <tokens>] [--json]
138
139
  toloka training cost <name-or-id> [--idempotency-key <key>] [--json]
139
140
  toloka training run <name-or-id> [--estimate-file <path>] [--version-name <name>] [--idempotency-key <key>] [--json]
140
141
  toloka training runs <name-or-id> [--json]
@@ -149,9 +150,9 @@ toloka skill install <skill-id> [--force]
149
150
  toloka report <markdown> [--authored-by human|agent] [--confirm]
150
151
  ```
151
152
 
152
- Select the platform project with `toloka project add` or `toloka project create` before `import`, `plan`, or `apply`. For `init`, `toloka --project-id <id> init` and `TOLOKA_PROJECT_ID` bind an empty checkout directly without changing the machine registry. `project create` also writes `toloka.json`; `project add` changes only the machine registry, so follow it with `import <projectId>` for an existing project or an explicit project ID on `init` for an empty one. Confirm `toloka project current` and `toloka.json` resolve to the intended ID before authoring.
153
+ Resolve the intended platform project before `import`, `plan`, or `apply`; use an existing correct binding rather than registering or creating a project again. For `init`, `toloka --project-id <id> init` and `TOLOKA_PROJECT_ID` bind an empty checkout directly without changing the machine registry. `project create` also writes `toloka.json`; `project add` changes only the machine registry, so follow it with `import <projectId>` for an existing project or an explicit project ID on `init` for an empty one. Confirm `toloka project current` and `toloka.json` resolve to the intended ID before authoring.
153
154
 
154
- `toloka delivery-order list` and `project create --delivery-order-id` appear only when `toloka whoami` prints `Internal: true`. For an internal user, list active Sunday orders first; if the list is empty, stop. Pass a selected id to `project create` — internal teams require it. When `Internal: false`, omit the flag and do not run `delivery-order`.
155
+ `toloka delivery-order list` and `project create --delivery-order-id` are always available; the platform accepts them only for internal teams. When `toloka whoami` marks the project's owning team `(internal)` on its `Teams:` line, list active Sunday orders first; if the list is empty, stop. Pass a selected id to `project create` — internal teams require it. For a project in an external team, omit the flag; the platform rejects an order there.
155
156
 
156
157
  `toloka project url` prints only the selected project's platform UI URL. Use it when the user needs a working link to inspect the live project.
157
158
 
@@ -159,13 +160,15 @@ Select the platform project with `toloka project add` or `toloka project create`
159
160
 
160
161
  ## Manage model checkpoints
161
162
 
162
- The global Base Model Catalog is read-only and uses `toloka base-model`. `base-model list` prints aligned ID, name, provider, and upstream-model columns by default. `toloka model` manages project-owned lineages; creation requires one catalog `baseModelId` and creates metadata without a Model Version. Every Base Model and Model command accepts `--json` for machine-readable output. Model Version upload, validation, and download commands are deferred until the separate upload-processing contract is implemented.
163
+ The global Base Model Catalog is read-only and uses `toloka base-model`. `base-model list` prints aligned ID, name, provider, upstream-model, revision (first 12 characters) and upstream-snapshot URL columns by default; `base-model get` prints the full pinned revision and the `https://huggingface.co/<model>/tree/<revision>` snapshot URL, which is the exact base every Training Run trains on. `toloka model` manages project-owned lineages; creation requires one catalog `baseModelId` and creates metadata without a Model Version. Every Base Model and Model command accepts `--json` for machine-readable output. Model Version upload, validation, and download commands are deferred until the separate upload-processing contract is implemented.
163
164
 
164
165
  ## Train a model
165
166
 
166
- `toloka training create` requires one source (`--base-model` or `--model-version`) and a training Dataset. The output Model is created on the first Training Run from the Training name, or bound from an existing Model Version source.
167
+ `toloka training create` requires one source (`--base-model` or `--model-version`) and a training Dataset. A `--model-version` source must be a LoRA adapter Model Version (one produced by fine-tuning) and works for both methods — SFT continues the adapter, gisting merges it and trains gist tokens over it; a full-weights version is rejected with "Training from a Model Version requires a LoRA adapter source". The first Training Run creates a new output Model named after the Training; a source Model Version is only the training parent, never the output binding.
167
168
 
168
- Use `training cost` to validate inputs and show the maximum charge before `training run`. `training run` accepts that ready estimate JSON through `--estimate-file`; without it, the command calculates a fresh ready estimate itself before creating the run. `--version-name` defaults to the Training name; pass it when a Model Version with that name already exists. Use `training status`, `training logs`, `training metrics`, `training resume`, and `training cancel` with the returned Training Run ID. `training metrics` lists each metric's latest value while the run is still training; `--key` prints one metric's point history instead.
169
+ Hyperparameters are optional flags on `training create` and `training update`: `--epochs 1..5` (default 3), `--learning-rate` (SFT 0.00001–0.001, default 0.00015; gisting 0.001–0.3, default 0.03), `--batch-size 8|16|32|64` (default 8; sequences per optimizer step across all GPUs) and `--max-sequence-length 64..16384` (default 12288 for SFT, 3072 for gisting) apply to both methods; `--lora-rank 8|16|32` (default 16) is SFT-only and `--gist-tokens 8|32|64` (default 32) is gisting-only — passing one to the other method fails before any request. `--regime` and `--eval-steps` no longer exist. `training update` has no `--method` flag: the method stays as created, and every flag you omit keeps its current value. `training cost` is blocked when the longest example exceeds `--max-sequence-length` or when the training selection leaves fewer rows than `--batch-size` after the 10% holdout.
170
+
171
+ Use `training cost` to validate inputs and show the maximum charge before `training run`. A blocked estimate exits 1 and lists the issues on stderr instead of printing the estimate; fix them and recalculate. `training run` accepts that ready estimate JSON through `--estimate-file`; without it, the command calculates a fresh ready estimate itself before creating the run. `--version-name` defaults to the Training name; pass it when a Model Version with that name already exists. Use `training status`, `training logs`, `training metrics`, `training resume`, and `training cancel` with the returned Training Run ID. `training metrics` lists each metric's latest value while the run is still training; `--key` prints one metric's point history instead.
169
172
 
170
173
  ## Adopt an existing live project
171
174
 
@@ -235,7 +238,7 @@ Register every code-node behavior with `test.code(pipeline, node, name, callback
235
238
 
236
239
  Before choosing component names or props, call `ui.componentDocumentation()` in a local `@toloka-platform/sdk/testing` scenario. A component's contract is its returned `propsType`, `valueType`, and `example`. For structured or array-valued Fields, derive the dataset field schema from `valueType`, then feed the documented example value through `setValue`, `getValue`, and `submit`; never translate undocumented property names or replace missing values with defaults. Register required human-work behavior with `test.ui(pipeline, node, name, callback)`. Its callback receives bound `render(options?)`; the test counts only after a successful `submit`, at least one assertion, and a passing callback.
237
240
 
238
- Register the representative connected flow with `test.pipeline(pipeline, name, callback)`. When a local dataset file is available, use its first row as the initial item state; redact sensitive values while preserving field names, nesting, optionality, and media/value shapes. Use synthetic input only when no local row exists. Use the callback's bound `runCode` and `renderUi` helpers, merge only declared node outputs, and assert the final `root.completed` fields. Keep a linear happy path in one test; use separate scenarios for match branches, optional routes, and failures.
241
+ Register representative connected flows with `test.pipeline(pipeline, name, callback)`. Choose fixtures from available data that exercise the task, redacting sensitive values while preserving field names, nesting, optionality, and media/value shapes. Use synthetic cases for privacy or boundaries absent from the sample. Use the callback's bound `runCode` and `renderUi` helpers, merge only declared node outputs, and assert the final `root.completed` fields. Cover meaningful match branches, optional routes, and failures as well as the happy path.
239
242
 
240
243
  ```sh
241
244
  toloka check
@@ -269,7 +272,7 @@ Pull live rows with `toloka dataset load <name> --out <file> [--limit <n>]`. `--
269
272
 
270
273
  ## Run a pipeline and report results
271
274
 
272
- A run needs a deployed pipeline, so apply before starting one.
275
+ A run needs a deployed pipeline. Apply any requested source changes and verify convergence first; an already-deployed unchanged pipeline does not need another apply. Present the cost forecast and obtain run approval before starting. The commands below are available operations, not a sequence that requires starting or canceling a run.
273
276
 
274
277
  ```sh
275
278
  toloka pipeline run <name> --wait --timeout 900000
@@ -282,7 +285,7 @@ toloka pipeline cancel <runId>
282
285
 
283
286
  Read the exit code, not just the text. `toloka pipeline run --wait` exits `0` when the run reaches a successful terminal state, `1` when it reaches a failed one, and `2` when the wait window elapses while the run is still going. Without `--wait` the command returns as soon as the run is accepted, and exit `0` means "accepted", not "succeeded".
284
287
 
285
- Never treat a started run as a finished one. There is no background watcher: nothing will report back later. But bound every wait — a queue no one is working stays in progress indefinitely, and an unbounded poll loop ends with the agent killed and no report written. Pick a window, and when it closes report the observed counts and states along with the fact that the run had not finished. Poll in the foreground and deliver that report before you finish: there is no later turn, so promising to report once a window closes loses the observation entirely.
288
+ A started run is not a finished one. Choose a bounded monitoring window appropriate to the task, then report observed counts and states even if work is still in progress. Continue with another bounded check when useful; do not promise an automatic later update unless a reporting mechanism actually exists.
286
289
 
287
290
  `toloka pipeline runs` lists ids and timestamps. `toloka pipeline status` reports the latest run. `toloka status` (no prefix) is project health. When a listing is capped it says so; report the cap rather than presenting a page as the whole picture.
288
291
 
@@ -5,68 +5,151 @@ description: Create, estimate, start, monitor, and verify a project-owned superv
5
5
 
6
6
  # Fine-tune a model with Toloka
7
7
 
8
- Use this skill for supervised fine-tuning. For the full first-time agent sequence, read `https://platform.toloka.ai/agents/fine-tuning.md`.
8
+ ## Mission
9
9
 
10
- ## Rules
10
+ Help the user adapt a compatible model from labeled conversations while preserving their intended task, data, model, and budget constraints. Match the work to the requested outcome: inspect an existing Training or run, prepare a draft, calculate an estimate, start an approved run, monitor it, or retrieve its output. Do not create resources or start a run merely because they appear later in this reference.
11
+
12
+ For first-time setup details, read `https://platform.toloka.ai/agents/fine-tuning.md`.
13
+
14
+ ## Domain model
15
+
16
+ - **SFT** adapts model weights from representative chat examples. Each training row must follow the platform chat contract and end with the assistant response the model should learn to produce.
17
+ - A **Training** is an editable project-owned draft. A **Training Run** is one immutable, billable execution of a frozen draft and Dataset selections.
18
+ - A run can start from a catalog **Base Model** or an exact existing **Model Version**. An explicit Model Version is the source; do not also select a Base Model.
19
+ - A completed run publishes a durable Model Version. It does not prove deployment or inference readiness.
20
+ - Training and validation are data roles, not file-layout rules. Separate Datasets and disjoint top-level filters are both valid. Without a validation selection, the provider reserves 10% of the training rows as a holdout.
21
+
22
+ ## Working posture
23
+
24
+ - Inspect the user's request and current CLI, project, Training, Dataset, and run state before changing anything. The process below is a dependency map: skip satisfied or irrelevant work and stop when the requested outcome is complete.
25
+ - Honor explicit choices first. If a requested project, source, Dataset, or configuration is incompatible, explain the evidence and tradeoff before proposing a substitute.
26
+ - Make routine reversible choices and briefly explain them. Ask a focused question only for material ambiguity, missing authorization or inputs, conflicting constraints, or destructive or out-of-scope changes.
27
+ - If the goal is prompt compression or data labeling rather than SFT, explain the distinction and route to `toloka-gisting` or `toloka-build`; never silently change the method.
28
+
29
+ ## Safety
11
30
 
12
31
  - Never ask for an API key in chat; the user enters it through `toloka login`.
13
- - Never invent project, Dataset, Base Model, Training, Model, Model Version, price, or run IDs.
14
- - Use authorized project Datasets containing labeled conversations. Keep production data out of source control.
15
- - Prefer a separate validation Dataset. Without one, the provider holds out 10% of training rows.
16
- - Do not start a Training Run before the user approves the ready estimate's `maximumCharge`.
17
- - Use `--model-version` only for an existing Model Version source.
18
- - Keep polling bounded and report terminal state only when the CLI shows it.
19
-
20
- ## Workflow
21
-
22
- 1. Verify `bun --version`, `toloka --version`, `toloka whoami`, and `toloka project current`.
23
- 2. Inspect the exact training Dataset ID supplied by the user:
24
- ```sh
25
- toloka dataset fields <training-dataset-id>
26
- ```
27
- 3. Verify the supplied Base Model ID or existing Model Version source:
28
- ```sh
29
- toloka base-model get <base-model-id>
30
- ```
31
- 4. Ask the user to choose the source, training Dataset, optional validation Dataset, and Training name.
32
- 5. Create the normalized SFT Training:
33
- ```sh
34
- toloka training create "<training-name>" \
35
- --base-model <base-model-id> \
36
- --dataset <training-dataset-id> \
37
- --validation-dataset <validation-dataset-id> \
38
- --json
39
- ```
40
- Omit `--validation-dataset` when the user chooses provider holdout. Use `--model-version <model-version-id>` instead of `--base-model` for an existing Model Version source.
41
- 6. Verify the draft:
42
- ```sh
43
- toloka training get <training-id> --json
44
- ```
45
- 7. Calculate a ready estimate to an absolute path:
46
- ```sh
47
- toloka training cost <training-id> --json > <absolute-estimate-file>
48
- ```
49
- Report rows, tokens, maximum GPU seconds, `maximumCharge`, currency, and fingerprint. Fix every blocked issue and recalculate after changing inputs.
50
- 8. Ask the user to approve the exact `maximumCharge`. After approval, start one run:
51
- ```sh
52
- toloka training run <training-id> \
53
- --estimate-file <absolute-estimate-file> \
54
- --version-name <unique-version-name> \
55
- --json
56
- ```
57
- Both flags are optional. Without `--estimate-file`, `training run` calculates a fresh ready estimate itself; without `--version-name`, the Model Version takes the Training name. Passing the approved estimate prevents a fresh quote from replacing the reviewed one.
58
- 9. Monitor with bounded commands:
59
- ```sh
60
- toloka training status <training-run-id> --json
61
- toloka training logs <training-run-id>
62
- toloka training metrics <training-run-id> --json
63
- ```
64
- Resume only after the user confirms a billing block is resolved. Cancel only on explicit request.
65
- 10. When completed, verify the output Model and Model Version, then download if requested:
66
- ```sh
67
- toloka training get <training-id> --json
68
- toloka model get <model-id> --json
69
- toloka model version download <model-version-id> --out <absolute-output-directory>
70
- ```
71
-
72
- A completed Training Run produces a durable Model Version. It does not prove deployment or inference readiness.
32
+ - Never invent project, Dataset, Base Model, Training, Model, Model Version, price, or run IDs. Read identity and source metadata from the CLI.
33
+ - Use only authorized project Datasets containing representative data. Keep credentials and production data out of source control and agent messages.
34
+ - Preserve train/validation separation and avoid duplicate or near-duplicate examples across roles.
35
+ - Never start a Training Run before the user approves the ready estimate's exact `maximumCharge`.
36
+ - Keep polling bounded. Report terminal state only when the CLI shows it, and report timeouts as still running.
37
+
38
+ ## Process
39
+
40
+ ### 1. Establish only the context the goal needs
41
+
42
+ When runtime, authentication, or binding is unknown, inspect it:
43
+
44
+ ```sh
45
+ bun --version
46
+ toloka --version
47
+ toloka whoami
48
+ toloka project current
49
+ ```
50
+
51
+ Reuse an authenticated, compatible workspace. For an inspection request, inspect existing resources rather than creating a project, Dataset, Training, or run.
52
+
53
+ Use the project the user explicitly requested. Otherwise keep the current binding when it is consistent with the task. If no suitable project is bound and the requested work needs one, inspect `toloka project list --limit 20`, then create a task-named project or register the exact existing project the user identified. Do not silently select an unrelated project or rebind an existing checkout; use an explicit `--project-id` or a separate source root when working against another project without changing the binding.
54
+
55
+ ### 2. Inspect and assign data roles
56
+
57
+ ```sh
58
+ toloka dataset list
59
+ toloka dataset fields <dataset-name-or-id>
60
+ ```
61
+
62
+ Use the user's authorized data and existing role assignments. If local JSONL files must be uploaded, organize Datasets by training and validation role, not automatically by file. `dataset upload` appends, so compatible files for one role can share a Dataset:
63
+
64
+ ```sh
65
+ toloka dataset create <role-dataset-name>
66
+ toloka dataset upload <role-dataset-name> <absolute-jsonl-path>
67
+ toloka dataset fields <role-dataset-name>
68
+ ```
69
+
70
+ CLI uploads to an otherwise undeclared Dataset store each row whole. A nested `split` value in that uploaded object is not a top-level Dataset field and cannot be used by `--train-filter` or `--validation-filter`. In that case, use separate role Datasets or omit validation flags and use the provider's 10% holdout. Existing Datasets with a real top-level split field can use disjoint filters. Never use overlapping selections or mix a supplied validation set back into training.
71
+
72
+ ### 3. Choose and verify the source
73
+
74
+ Explicit source choices take precedence. An existing Model Version bypasses Base Model selection.
75
+
76
+ ```sh
77
+ toloka base-model list --json
78
+ toloka base-model get <base-model-id> --json
79
+ toloka model list --json
80
+ toloka model get <model-id> --json
81
+ toloka model versions <model-id> --json
82
+ ```
83
+
84
+ For a Base Model, compare upstream documentation, user-provided benchmarks, and prior results for task and language fit, data volume, quality, training budget, and serving latency or deployment constraints. Model size alone is not a quality decision; a smaller model is a useful cost and latency baseline when the task permits it, not a mandatory default. Use `base-model get` only to verify the selected catalog ID, upstream model, and pinned revision; it does not establish those broader capabilities.
85
+
86
+ For a Model Version, verify the exact ID and revision under its project-owned Model, and record the owning Model's Base Model and the Version's runtime base from JSON. If those identities conflict, report the conflict rather than guessing or substituting. Use `--model-version` only for that existing version, and only for a LoRA adapter Model Version (one produced by fine-tuning) — a full-weights version is rejected with "Training from a Model Version requires a LoRA adapter source". The ready cost estimate is the concrete final check that the source type, underlying Base Model, method, and data are supported together.
87
+
88
+ ### 4. Reuse or create the draft
89
+
90
+ Inspect before creating another Training:
91
+
92
+ ```sh
93
+ toloka training list --json
94
+ toloka training get <training-id> --json
95
+ ```
96
+
97
+ When a new draft is needed, use a descriptive name and create normalized SFT configuration:
98
+
99
+ ```sh
100
+ toloka training create "<training-name>" \
101
+ --base-model <base-model-id> \
102
+ --dataset <training-dataset-id> \
103
+ --validation-dataset <validation-dataset-id> \
104
+ --json
105
+ ```
106
+
107
+ Omit `--validation-dataset` when no separate validation selection exists so the provider uses its 10% holdout. For disjoint selections in a Dataset with top-level fields, add `--train-filter <field>=<value>` and `--validation-filter <field>=<value>`. For an existing Model Version source, replace `--base-model` with `--model-version <model-version-id>`.
108
+
109
+ Preserve requested hyperparameters. The current CLI uses `--lora-rank 8|16|32` (default 16), `--epochs 1..5` (default 3), `--learning-rate` within 0.00001–0.001 (default 0.00015), `--batch-size 8|16|32|64` (default 8), and `--max-sequence-length 64..16384` (default 12288), rather than `regime`. Use defaults when suitable; rank 8 can fit narrow tasks or small data, while 32 may help when 16 underfits and the data supports more capacity. Choose sequence length from actual examples within the supported limit. `--gist-tokens` is rejected for SFT. `training update <name-or-id>` takes the same flags except `--method`; omitted flags retain current values.
110
+
111
+ Verify the saved method, exact source, selections, filters, and configuration with `toloka training get <training-id> --json`.
112
+
113
+ ### 5. Validate and estimate
114
+
115
+ ```sh
116
+ toloka training cost <training-id> --json > <absolute-estimate-file>
117
+ ```
118
+
119
+ A blocked estimate exits 1, leaves the redirected file empty, and prints `Training cannot run with these inputs:` followed by one `- <message>` line per issue on stderr. Report every issue, correct the cause, and calculate a new estimate.
120
+
121
+ For a duration issue, use the reported rows, tokens, epochs, GPU count, and wall time to compare supported options. `qwen3-32b` and `qwen3-235b` use 8 GPUs and can reduce wall time, but changing the model also changes quality, serving constraints, and cost; reducing rows can weaken coverage; reducing epochs can weaken adaptation. Do not change the requested model, silently discard data, or alter epochs merely to make the estimate pass. Present the tradeoff, obtain direction when it is material, then update the draft, re-estimate, and obtain approval for the new quote.
122
+
123
+ For a ready estimate, report the source and selections, training and validation row counts, token totals, maximum GPU seconds, `maximumCharge`, currency, and fingerprint. If the user asked only for an estimate, stop here.
124
+
125
+ ### 6. Run only after explicit cost approval
126
+
127
+ Ask the user to approve the exact ready `maximumCharge`. After approval, start only the requested run and pass the approved file so a new unseen quote cannot replace it:
128
+
129
+ ```sh
130
+ toloka training run <training-id> \
131
+ --estimate-file <absolute-estimate-file> \
132
+ --version-name <unique-version-name> \
133
+ --json
134
+ ```
135
+
136
+ Both flags are optional at the CLI level. Without `--estimate-file`, `training run` calculates a fresh ready estimate; do not use that path when the user approved a saved quote. Without `--version-name`, the Model Version takes the Training name.
137
+
138
+ Monitor only as far as the user requested, with bounded commands:
139
+
140
+ ```sh
141
+ toloka training status <training-run-id> --json
142
+ toloka training logs <training-run-id>
143
+ toloka training metrics <training-run-id> --json
144
+ ```
145
+
146
+ Resume only after the user confirms a billing block is resolved. Cancel only on explicit request.
147
+
148
+ For a completed run, verify the observed output and download only when requested:
149
+
150
+ ```sh
151
+ toloka training get <training-id> --json
152
+ toloka model get <model-id> --json
153
+ toloka model versions <model-id> --json
154
+ toloka model version download <model-version-id> --out <absolute-output-directory>
155
+ ```