docs(adaptive): document opt-in tool result caching - #598
docs(adaptive): document opt-in tool result caching#598zhongxuanwang-nv wants to merge 4 commits into
Conversation
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
WalkthroughThe adaptive caching documentation now covers classified tool results alongside LLM responses. It adds tool-cache behavior, policies, observability, configuration, validation diagnostics, storage guidance, and Rust migration instructions. ChangesAdaptive cache documentation
Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/configure-plugins/adaptive/response-cache.mdx`:
- Around line 371-396: Update the response-cache documentation to ensure
unmatched tools always use an uncacheable tools.default policy. Remove or revise
any recommended broad catch-all configuration that enables caching without
explicit read-only classification, and document validation rejecting cacheable
global catch-all policies; apply the same correction to the referenced sections.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Enterprise
Run ID: 64630caa-dd21-4130-847c-0360123523cf
📒 Files selected for processing (5)
crates/adaptive/README.mddocs/configure-plugins/adaptive/about.mdxdocs/configure-plugins/adaptive/configuration.mdxdocs/configure-plugins/adaptive/response-cache.mdxdocs/reference/migration-guides.mdx
📜 Review details
🧰 Additional context used
📓 Path-based instructions (16)
**/*.mdx
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/SKILL.md)
MDX top-of-file SPDX comments must use {/* ... */} delimiters instead of HTML comment delimiters (Must-Fix)
In MDX files, top-of-file comments must use JSX comment delimiters (
{/*to open and*/}to close); do not use HTML comments for MDX SPDX headers
Files:
docs/configure-plugins/adaptive/configuration.mdxdocs/configure-plugins/adaptive/about.mdxdocs/reference/migration-guides.mdxdocs/configure-plugins/adaptive/response-cache.mdx
**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
Update
README.md,fern/, package READMEs, and binding-support notes when public behavior, package names, examples, or supported bindings change.
**/*.{md,mdx}: Prefer the documented public API, not internal shortcuts
Keep package names, repo references, and build commands current
Keep release-process and release-notes guidance in repo-maintainer docs such asRELEASING.md, not as user-facing docs pages orCHANGELOG.md
Keep stable user-facing wrappers atscripts/root in docs and examples; only point at namespaced helper paths when documenting internal maintenance work
When detailed dynamic plugin guides exist, keep Rust native plugin examples, Python worker plugin examples, andgrpc-v1protocol details on separate pagesIf links in documentation change, run
just docs-linkcheck.
Files:
docs/configure-plugins/adaptive/configuration.mdxdocs/configure-plugins/adaptive/about.mdxcrates/adaptive/README.mddocs/reference/migration-guides.mdxdocs/configure-plugins/adaptive/response-cache.mdx
**/*.{md,markdown,mdx}
📄 CodeRabbit inference engine (CONTRIBUTING.md)
Add the SPDX license header to all Markdown/MDX documentation files using the HTML comment block form.
Files:
docs/configure-plugins/adaptive/configuration.mdxdocs/configure-plugins/adaptive/about.mdxcrates/adaptive/README.mddocs/reference/migration-guides.mdxdocs/configure-plugins/adaptive/response-cache.mdx
{docs,examples}/**/*
📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Update docs and examples.
Files:
docs/configure-plugins/adaptive/configuration.mdxdocs/configure-plugins/adaptive/about.mdxdocs/reference/migration-guides.mdxdocs/configure-plugins/adaptive/response-cache.mdx
**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, usemaintain-dynamic-pluginsand include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, preferuv run pre-commit run --files <changed files...>.
Before review or handoff, runuv run pre-commit run --all-files.
Files:
docs/configure-plugins/adaptive/configuration.mdxdocs/configure-plugins/adaptive/about.mdxcrates/adaptive/README.mddocs/reference/migration-guides.mdxdocs/configure-plugins/adaptive/response-cache.mdx
docs/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If documentation examples or commands under
docs/change, run the targeted docs checks appropriate to the change.
Files:
docs/configure-plugins/adaptive/configuration.mdxdocs/configure-plugins/adaptive/about.mdxdocs/reference/migration-guides.mdxdocs/configure-plugins/adaptive/response-cache.mdx
**/*.{md,mdx,py,go,js,ts}
📄 CodeRabbit inference engine (.agents/skills/maintain-observability/SKILL.md)
Examples and documentation must use each exporter's documented flush/deregister order before shutdown.
Files:
docs/configure-plugins/adaptive/configuration.mdxdocs/configure-plugins/adaptive/about.mdxcrates/adaptive/README.mddocs/reference/migration-guides.mdxdocs/configure-plugins/adaptive/response-cache.mdx
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}
⚙️ CodeRabbit configuration file
{docs/**,README.md,CONTRIBUTING.md,RELEASING.md,SECURITY.md}: Review documentation for technical accuracy against the current API, command correctness, and consistency across language bindings.
Flag stale examples, missing SPDX headers where required, and instructions that no longer match CI or pre-commit behavior.
Files:
docs/configure-plugins/adaptive/configuration.mdxdocs/configure-plugins/adaptive/about.mdxdocs/reference/migration-guides.mdxdocs/configure-plugins/adaptive/response-cache.mdx
**/*.{md,rst,html,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
**/*.{md,rst,html,txt}: Always spellNVIDIAin all caps. Do not useNvidia,nvidia,nVidia,nVIDIA, orNV.
Usean NVIDIAbefore a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol afterNVIDIAwhen referring to the company.
Use trademark symbols with product names only when the document type or legal guidance requires them.
Verify official capitalization, spacing, and hyphenation for product names.
Precede NVIDIA product names withNVIDIAon first mention when it is natural and accurate.
Do not rewrite product names for grammar or title-case rules.
Preserve third-party product names according to the owner's spelling.
Include the company name and full model qualifier on first use when it helps identify the model.
Preserve the official capitalization and punctuation of model names.
Use shorter family names only after the full name is established.
Spell out a term on first use and put the acronym in parentheses unless the acronym is widely understood by the intended audience.
Use the acronym on later mentions after it has been defined.
For long documents, reintroduce the full term if readers might lose context.
Form plurals of acronyms withs, not an apostrophe, such asGPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such asCPU,GPU,PC,API, andUIusually do not need to be spelled out for developer audiences.
Files:
crates/adaptive/README.md
**/*.{md,rst,html}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-brand-terminology.md)
Link the first mention of a product name when the destination helps the reader.
Files:
crates/adaptive/README.md
{crates/core,crates/adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)
Changes to
crates/coreorcrates/adaptivemust run the full language matrix
Files:
crates/adaptive/README.md
**/*.{md,rst,txt}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
Spell
NVIDIAin all caps. Do not useNvidia,nvidia, orNV.
Files:
crates/adaptive/README.md
**/*.{md,rst}
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-guide.md)
**/*.{md,rst}: Format commands, code elements, expressions, package names, file names, and paths as inline code.
Use descriptive link text. Avoid raw URLs and weak anchors such as "here" or "read more."
Use title case consistently for technical documentation headings.
Introduce code blocks, lists, tables, and images with complete sentences.
Write procedures as imperative steps. Keep steps parallel and split long procedures into smaller tasks.
Prefer active voice, present tense, short sentences, contractions, and plain English.
Usecanfor possibility and reservemayfor permission.
Useafterfor temporal relationships instead ofonce.
Preferrefer tooverseewhen the wording points readers to another resource.
Avoid culture-specific idioms, unnecessary Latinisms, jokes, and marketing exaggeration in technical docs.
Spell out months in body text, avoid ordinal dates, and use clear time zones.
Spell out whole numbers from zero through nine unless they are technical values, parameters, versions, or UI values.
Use numerals for 10 or greater and include commas in thousands.
Do not add trademark symbols to learning-oriented docs unless the source, platform, or legal guidance explicitly requires them.
Files:
crates/adaptive/README.md
**/*.md
📄 CodeRabbit inference engine (.agents/skills/review-doc-style/assets/nvidia-style-technical-docs.md)
**/*.md: Use title case consistently in technical documentation headings
Avoid quotation marks, ampersands, and exclamation marks in headings
Keep product, event, research, and whitepaper names in their official title case
Use title case for table headers
Do not force social-media sentence case into technical docs
Format code elements, commands, parameters, package names, and expressions in monospace
Format directories, file names, and paths in monospace using backticks
Use angle brackets inside monospace for variables inside paths, such as/home/<username>/.login
Format error messages and strings in quotation marks, keeping literal code strings in code formatting when clearer
Format UI buttons, menus, fields, and labels in bold
Use angle brackets between UI labels for menu paths, such as File > Save As
Use italics for new terms on first use, sparingly and only when introducing the term
Use italics for publication titles
Format keyboard shortcuts in plain text, such as Press Ctrl+Alt+Delete
Use owner/repo link text for GitHub repositories, preferring[NVIDIA/NeMo](link)over prose references like 'the GitHub repo'
Introduce every code block with a complete sentence
Do not make a code block complete the grammar of the previous sentence
Do not continue a sentence after a code block
Use syntax highlighting when the format supports it for code blocks
Avoid the word 'snippet' unless the surrounding docs already use it as a term of art
Keep inline method, function, and class references consistent with nearby docs, omitting empty parentheses for prose readability when no call is shown
Use descriptive anchor text that matches the destination title when possible for links
Avoid raw URLs in running text
Avoid generic anchor text such as 'here,' 'this page,' and 'read more'
Include acronyms in link text when a linked term includes an acronym
Do not link long sentences or multiple sentences
Avoid links that pull readers away from a procedure unless the link is a p...
Files:
crates/adaptive/README.md
crates/adaptive/**
📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Keep
crates/adaptivealigned with the canonical adaptive config schema, built-in section helpers, plugin lifecycle, and validation/report behavior.
Files:
crates/adaptive/README.md
crates/{core,adaptive}/**/*
📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)
If
crates/coreorcrates/adaptivechanged, run the full validation matrix across Rust, Python, Go, and Node.js.
Files:
crates/adaptive/README.md
🪛 LanguageTool
docs/configure-plugins/adaptive/response-cache.mdx
[style] ~538-~538: This phrase is redundant. Consider writing “same”.
Context: ...onse_cache.tool_multiple_classes` | The same exact member or pattern appears in more than ...
(SAME_EXACT)
🔇 Additional comments (5)
crates/adaptive/README.md (1)
22-22: LGTM!docs/configure-plugins/adaptive/about.mdx (1)
25-25: LGTM!Also applies to: 55-57
docs/configure-plugins/adaptive/configuration.mdx (1)
36-36: LGTM!docs/configure-plugins/adaptive/response-cache.mdx (1)
3-25: LGTM!Also applies to: 296-298, 363-370, 398-466, 484-489, 501-510
docs/reference/migration-guides.mdx (1)
34-36: LGTM!
| Caching a tool call suppresses the real call. Cache only tools that are | ||
| read-only and stable for their TTL; do not cache a tool merely because it is | ||
| idempotent. A cache hit skips even an idempotent write. Classify each tool | ||
| explicitly before enabling the tool surface: | ||
|
|
||
| ```toml | ||
| [components.config.response_cache.tools] | ||
| enabled = true | ||
| cache_errors = false # default: do not store conventional in-band error results | ||
|
|
||
| [components.config.response_cache.tools.classes.read_only] | ||
| cacheable = true | ||
| ttl_seconds = 300 | ||
| arg_skip = ["trace_id"] | ||
| members = ["docs_*", "unit_convert"] | ||
|
|
||
| [components.config.response_cache.tools.overrides.docs_search] | ||
| tool_version = "v1" # identifies the deployed tool contract | ||
| ``` | ||
|
|
||
| An exact class member wins. Otherwise, Relay selects the most-specific matching | ||
| `*` pattern; an exact override wins over a wildcard override. Configuration | ||
| validation rejects overlapping wildcard class patterns or wildcard overrides | ||
| that disagree on `cacheable`, so a broad deny policy cannot silently become a | ||
| cacheable result. Unmatched tools use `tools.default`, which is uncacheable by | ||
| default. |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
Do Not Permit Cacheable Default Policies.
tools.default.cacheable and the recommended broad catch-all policy can cache unmatched tools. An unmatched tool has no explicit read-only classification. A cache hit suppresses the live callback, so this can skip a write or reuse an identity-scoped result.
Keep tools.default uncacheable. Reject cacheable global catch-all policies, or revise the documented eligibility guarantee.
Also applies to: 490-500, 526-544
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/configure-plugins/adaptive/response-cache.mdx` around lines 371 - 396,
Update the response-cache documentation to ensure unmatched tools always use an
uncacheable tools.default policy. Remove or revise any recommended broad
catch-all configuration that enables caching without explicit read-only
classification, and document validation rejecting cacheable global catch-all
policies; apply the same correction to the referenced sections.
Overview
Documents the opt-in Adaptive tool-result cache introduced in #597, including its safety constraints and configuration.
Details
nemo-relay doctoroutput, and validation diagnostics.just docs,just docs-linkcheck, anduv run pre-commit run --files docs/configure-plugins/adaptive/response-cache.mdx.Where should the reviewer start?
Start with the
Tool-Result Cachesection indocs/configure-plugins/adaptive/response-cache.mdx.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit