Skip to content

Add inventory record type prompt to notebook templating [sc-16131] - #553

Open
emmavdh wants to merge 5 commits into
mainfrom
emma/sc-16131/notebook-templating-record-types
Open

emmavdh wants to merge 5 commits into
mainfrom
emma/sc-16131/notebook-templating-record-types

Conversation

@emmavdh

@emmavdh emmavdh commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

What and why?

Adds an inventory record type step to notebook generation (make notebook / e2e-notebook.ipynb) so newly authored notebooks can target Model, Agent, Use Case, Tool, or a custom free-text type.

  • Separate prompt alongside the existing role/document-type selection
  • Defaults to Model on empty input
  • Fills {record-type} placeholders in install and next-steps mini-templates

Shortcut: https://app.shortcut.com/validmind/story/16131

How to test

  1. From repo root: make notebook (or run notebooks/templates/e2e-notebook.ipynb)
  2. After role/document type, confirm the record-type prompt offers 1–4, custom 5 / free text, and Enter → Model
  3. Choose e.g. Agent with install+initialize; open the generated notebook and confirm registration/next-steps text says Agent (no leftover {record-type})
  4. Repeat with a custom value and confirm substitution

What needs special review?

Wording of {record-type} substitutions in install/next-steps mini-templates (UI labels like Register {record-type}).

Dependencies, breaking changes, and deployment notes

None. Existing published notebooks are unchanged; only the generator and mini-templates used for new notebooks are affected.

Release notes

Internal contributor tooling for notebook authoring.

Checklist

  • What and why
  • Screenshots or videos (Frontend)
  • How to test
  • What needs special review
  • Dependencies, breaking changes, and deployment notes
  • Labels applied
  • PR linked to Shortcut
  • Unit tests added (Backend)
  • Tested locally
  • Documentation updated (if required)
  • Environment variable additions/changes documented (if required)

Ask for Model/Agent/Use Case/Tool (or custom free text, defaulting to Model) and fill {record-type} placeholders in install and next-steps mini-templates so newly generated notebooks can target different inventory record types.

Co-authored-by: Cursor <cursoragent@cursor.com>
@emmavdh emmavdh added internal Not to be externalized in the release notes chore Chore tasks that aren't bugs or new features labels Aug 11, 2026
Reword the "record" key concept so it no longer defines a record via "such as a model" (and keep Key concepts free of variables), and genericize "model identifier credentials" to "{record-type} identifier credentials" in the code-snippet step so it follows the selected inventory record type.

Co-authored-by: Cursor <cursoragent@cursor.com>
@emmavdh emmavdh self-assigned this Aug 11, 2026
@emmavdh
emmavdh requested review from cachafla and nibalizer August 11, 2026 21:43
@emmavdh
emmavdh requested a review from juanmleng August 28, 2026 03:16

@juanmleng juanmleng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: #553 at 07a2825 (merge-base 21fffbb)

Verdict: Merge with recommendations

Computed by the calibrated-review skill, run by @juanmleng.

Summary

  • What changed: Notebook generation now asks for an inventory record type (Model, Agent, Use Case, Tool, or free text; Enter defaults to Model) and fills {record-type} in the install and next-steps mini-templates.
  • Result: No blocking issues; three small fixes recommended.
  • Main thing to know: A custom record type containing a " or \ produces a notebook that will not open.
  • Next step: Apply the three fixes below (each a few lines) and answer the two wording questions; then good to merge.

Fix now

  • What: Some custom record types produce a notebook that won't open.
  • Why: A notebook file is structured text where quote marks have a special meaning, and the tool pastes the record type in exactly as typed. If someone enters a custom type with a quote in it, such as My "core" model, the file breaks and Jupyter can't open it. I tried this and it fails. It's rare, but the fix is one line.
  • Where: notebooks/templates/e2e_template.py:412
  • Suggested fix: Have the tool make the typed text safe before pasting it in. For whoever implements it: content.replace("{record-type}", json.dumps(value)[1:-1]).

  • What: A typo quietly becomes the record type.
  • Why: The menu offers 1–4 for the standard types and 5 for "type your own". Anything else is taken as a custom type without a warning, so a slip like typing 6 gives a notebook that says "Click + Register 6" all the way through. Option 5 already covers custom text, so the only thing this catches is mistakes.
  • Where: notebooks/templates/e2e_template.py:383
  • Suggested fix: If the answer isn't 1–5 or blank, say it isn't an option and ask again.

  • What: One instruction still shows a placeholder after the type is filled in.
  • Why: Step 3 of the registration instructions reads: "Select Agent by clicking on {Record} Inventory, where {Record} is the currently active type of record." By then the notebook knows it's Agent, so the {Record} part looks like a leftover bug to the reader.
  • Where: step 3 of "Register sample {record-type}" in:
    • notebooks/templates/install-validmind/_install-initialize-with-development.ipynb
    • notebooks/templates/install-validmind/_install-initialize-with-monitoring.ipynb
    • notebooks/templates/install-validmind/_install-initialize-with-validation.ipynb
  • Suggested fix: Change the step to "Click {record-type} Inventory." so it reads "Click Agent Inventory", and drop the "where {Record} is…" explanation.

Questions for a human

  • Owner: PR author
  • Question: Are capitalised record types mid-sentence intended?
  • Context: The values are capitalised to match button labels ("Register Model"), so prose reads "once you've registered your Use Case" or "unique to your Agent". Fine for labels, slightly odd in sentences. You flagged this wording for review; either accept it or substitute a lowercase form in prose.

  • Owner: PR author
  • Question: Should the Shortcut link come out of the PR description?
  • Context: This repo is public, and the body links to the internal Shortcut story. The [sc-…] tag in the title is enough for the integration to link the PR.

Accepted risks

  • What I checked: The about-validmind edits (dropping "such as a model" from the definition of a record) are outside the generator change.
  • Why it is acceptable: Docs-only wording, in line with the record-type direction of the PR; no behaviour change.

  • What I checked: replace_record_type runs after every appended mini-template and rewrites the whole notebook, so it would also substitute {record-type} typed by the author elsewhere in the notebook.
  • Why it is acceptable: That is the intended behaviour of a template placeholder, and it only affects newly generated notebooks.

Verification performed

  • Diff read in full (12 files).
  • replace_record_type called on _next-steps-development.ipynb at the PR head with My "core" model, then json.load → Expecting ',' delimiter (notebook corrupted).
    • Run with nbformat stubbed, since only the replacement function was under test.
  • make notebook end to end → NOT CHECKED.
  • PR-body claim "Enter → Model, no leftover {record-type}" → checked by reading the code only, not run.
  • No unit tests exist for the new functions; none run.

juanmleng and others added 2 commits October 2, 2026 10:27
- Escape the record type before writing it into the notebook, so a custom
  value with quotes or backslashes no longer produces an unreadable file
- Re-prompt on input other than 1-5 or Enter instead of taking a typo as
  a custom record type
- Name the inventory directly in the register step now that the record
  type is known

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add a {record-type-lower} placeholder for sentences ("your agent") and
  keep {record-type} for UI labels ("Register Agent")
- Lowercase only the built-in types; custom values stay as typed
- Document both placeholders in the templates README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juanmleng

Copy link
Copy Markdown
Contributor

@emmavdh I pushed the review fixes straight to your branch in 5e1a50a and b0384b6, so please pull before you push again.

The record type is now lowercase in sentences ("your agent") and stays capitalised on buttons ("Register Agent"); custom types are used as typed.

One small change: the menu now only accepts the listed options (1–5, or Enter for Model). Typing the word "Agent" instead of "2" will ask again — that's what stops a typo like "6" ending up in the notebook. Happy to revert that if you'd rather keep it.

@cachafla

cachafla commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

@juanmleng one thing before merging: select_record_type now re-prompts on anything that isn't blank or 1-5, so typing a custom name like Agent directly fails with "is not an option". The new notebook cell and the "[5: Custom (enter free text)]" label both say you can type it directly. Either treat any non-number input as the custom value, or drop that sentence from the notebook and README. Also, step 3's "Click Agent Inventory" assumes the inventory already shows that type, so a user whose inventory is on Model won't see that label.

…ropdown

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@juanmleng

Copy link
Copy Markdown
Contributor

Thanks @cachafla, good catches. Fixed in fe87b13: typing any non-numeric name (like Agent) at the record type prompt is now taken as the custom value, and only an unknown number re-prompts, so the notebook cell and the option 5 label are accurate now. Step 3 in the three install templates now says to pick {record-type} Inventory from the dropdown at the top of the Inventory page, since that's where the record type is switched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Chore tasks that aren't bugs or new features internal Not to be externalized in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants