record_print_outcome
Record print outcomes (success, failure, partial) to enhance cross-printer learning. Automatically update decoration reliability and classify failure modes when enabled.
Instructions
Record the outcome of a print for cross-printer learning.
The learning database helps agents make better decisions about which
printer to use for a given job and material. Outcomes are agent-curated
quality data — separate from the auto-populated print history.
**Safety**: Settings are validated against hard safety limits. Outcomes
with temperatures exceeding safe maximums are rejected to prevent
poisoning the learning database with dangerous data.
**Decoration feedback**: When ``decoration_slug`` is provided, the
corresponding decoration's proven-settings counter is auto-updated
(``success_count`` or ``failure_count``) so the library's tracked
reliability reflects real field outcomes without manual curation.
**Auto-classification** (opt-in): When ``auto_classify=True`` and the
outcome is ``"failed"`` with no explicit ``failure_mode``, the failure
classifier runs (:func:`kiln.failure_recovery.analyze_failure`) and
its result is mapped into the canonical DB vocabulary. The
classification is always echoed back in the ``auto_classification``
key of the response; it is only STORED as ``failure_mode`` when the
classifier's confidence meets or exceeds
``_AUTO_CLASSIFY_MIN_CONFIDENCE`` (0.75). Lower-confidence guesses
are surfaced to the caller without poisoning the learning database.
Args:
job_id: The job ID from the print queue.
outcome: One of ``"success"``, ``"failed"``, or ``"partial"``.
quality_grade: Optional — ``"excellent"``, ``"good"``, ``"acceptable"``, ``"poor"``.
failure_mode: Optional — e.g. ``"spaghetti"``, ``"layer_shift"``, ``"warping"``.
settings: Optional dict of print settings used (temp_tool, temp_bed, speed, etc.).
environment: Optional dict of environment conditions (ambient_temp, humidity).
notes: Optional free-text notes about the print.
printer_name: Printer used. Auto-resolved from job if omitted.
file_name: File printed. Auto-resolved from job if omitted.
file_hash: Optional hash of the file for cross-printer comparison.
material_type: Material used (e.g. ``"PLA"``, ``"PETG"``).
decoration_slug: Optional decoration slug that was applied to this
print. When set, the matching decoration's success/failure
counters are auto-updated.
decoration_settings: Optional dict of decoration settings used
(``depth_mm``, ``mode``, ``image_style``). Falls back to the
decoration's current defaults when omitted.
auto_classify: When True and this outcome is a failure with no
explicit ``failure_mode``, run the failure classifier and
store its best-guess mode if confidence >= 0.75. Default
False — callers opt in.
auto_recorded: When True, tags the outcome as auto-fired by
the terminal-state hook (see
:mod:`kiln.auto_record_hook`). Agents can later refine
the outcome by calling record_print_outcome again with the
same ``job_id`` — the most recent call wins at the
``proven_settings`` level. Default False.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| notes | No | ||
| job_id | Yes | ||
| outcome | Yes | ||
| settings | No | ||
| file_hash | No | ||
| file_name | No | ||
| environment | No | ||
| failure_mode | No | ||
| printer_name | No | ||
| auto_classify | No | ||
| auto_recorded | No | ||
| material_type | No | ||
| quality_grade | No | ||
| decoration_slug | No | ||
| decoration_settings | No |