Skip to content

docs(adaptive): document opt-in tool result caching - #598

Open
zhongxuanwang-nv wants to merge 4 commits into
NVIDIA:mainfrom
zhongxuanwang-nv:docs/response-cache-stage3-docs
Open

docs(adaptive): document opt-in tool result caching#598
zhongxuanwang-nv wants to merge 4 commits into
NVIDIA:mainfrom
zhongxuanwang-nv:docs/response-cache-stage3-docs

Conversation

@zhongxuanwang-nv

@zhongxuanwang-nv zhongxuanwang-nv commented Jul 31, 2026

Copy link
Copy Markdown
Member

Overview

Documents the opt-in Adaptive tool-result cache introduced in #597, including its safety constraints and configuration.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Adds tool-cache configuration and safe usage guidance: only explicitly classified read-only, TTL-stable tools are eligible.
  • Documents class and per-tool policy resolution, cache-key versioning, observability marks, nemo-relay doctor output, and validation diagnostics.
  • Clarifies the shared cache observability fields for LLM token savings versus tool invocation savings.
  • Breaking changes: none.
  • Validation: just docs, just docs-linkcheck, and uv run pre-commit run --files docs/configure-plugins/adaptive/response-cache.mdx.

Where should the reviewer start?

Start with the Tool-Result Cache section in docs/configure-plugins/adaptive/response-cache.mdx.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

Summary by CodeRabbit

  • Documentation
    • Clarified that adaptive response caching supports repeated LLM responses and classified tool results.
    • Added guidance on tool classification, caching policies, key identity, errors, observability, security, and configuration.
    • Added migration instructions for initializing response cache tool settings and using default configuration values.

Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The 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.

Changes

Adaptive cache documentation

Layer / File(s) Summary
Cache scope and migration guidance
crates/adaptive/README.md, docs/configure-plugins/adaptive/about.mdx, docs/configure-plugins/adaptive/configuration.mdx, docs/configure-plugins/adaptive/response-cache.mdx, docs/reference/migration-guides.mdx
The documentation expands cache coverage to classified tool results and updates ResponseCacheConfig migration guidance.
Tool-result cache behavior
docs/configure-plugins/adaptive/response-cache.mdx
The response-cache page documents tool classification, policy precedence, key identity, isolation, error handling, and interceptor ordering.
Operations and validation
docs/configure-plugins/adaptive/response-cache.mdx
The page adds tool-cache observability, configuration fields, storage warnings, and validation diagnostics.

Estimated code review effort: 3 (Moderate) | ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the required Conventional Commits format, has a valid lowercase type and scope, uses an imperative summary, and is under 72 characters.
Description check ✅ Passed The description includes all required sections, completed checklist items, implementation details, reviewer guidance, validation results, and a related issue reference.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:S PR is small Documentation documentation-related labels Jul 31, 2026
@willkill07 willkill07 added this to the 0.8 milestone Jul 31, 2026
@github-actions

Copy link
Copy Markdown

Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
@github-actions github-actions Bot added size:M PR is medium and removed size:S PR is small labels Jul 31, 2026
@willkill07 willkill07 changed the title docs: document tool-result caching docs(adaptive): document opt-in tool result caching Jul 31, 2026
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
Signed-off-by: Zhongxuan Wang <daniewang@nvidia.com>
@zhongxuanwang-nv
zhongxuanwang-nv marked this pull request as ready for review August 3, 2026 23:09
@zhongxuanwang-nv
zhongxuanwang-nv requested review from a team as code owners August 3, 2026 23:09

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between cc72c3e and 65a2072.

📒 Files selected for processing (5)
  • crates/adaptive/README.md
  • docs/configure-plugins/adaptive/about.mdx
  • docs/configure-plugins/adaptive/configuration.mdx
  • docs/configure-plugins/adaptive/response-cache.mdx
  • docs/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.mdx
  • docs/configure-plugins/adaptive/about.mdx
  • docs/reference/migration-guides.mdx
  • docs/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 as RELEASING.md, not as user-facing docs pages or CHANGELOG.md
Keep stable user-facing wrappers at scripts/ 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, and grpc-v1 protocol details on separate pages

If links in documentation change, run just docs-linkcheck.

Files:

  • docs/configure-plugins/adaptive/configuration.mdx
  • docs/configure-plugins/adaptive/about.mdx
  • crates/adaptive/README.md
  • docs/reference/migration-guides.mdx
  • docs/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.mdx
  • docs/configure-plugins/adaptive/about.mdx
  • crates/adaptive/README.md
  • docs/reference/migration-guides.mdx
  • docs/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.mdx
  • docs/configure-plugins/adaptive/about.mdx
  • docs/reference/migration-guides.mdx
  • docs/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, use maintain-dynamic-plugins and 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, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • docs/configure-plugins/adaptive/configuration.mdx
  • docs/configure-plugins/adaptive/about.mdx
  • crates/adaptive/README.md
  • docs/reference/migration-guides.mdx
  • docs/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.mdx
  • docs/configure-plugins/adaptive/about.mdx
  • docs/reference/migration-guides.mdx
  • docs/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.mdx
  • docs/configure-plugins/adaptive/about.mdx
  • crates/adaptive/README.md
  • docs/reference/migration-guides.mdx
  • docs/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.mdx
  • docs/configure-plugins/adaptive/about.mdx
  • docs/reference/migration-guides.mdx
  • docs/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 spell NVIDIA in all caps. Do not use Nvidia, nvidia, nVidia, nVIDIA, or NV.
Use an NVIDIA before a noun because the name starts with an 'en' sound.
Do not add a registered trademark symbol after NVIDIA when 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 with NVIDIA on 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 with s, not an apostrophe, such as GPUs.
In headings, common acronyms can remain abbreviated. Spell out the term in the first or second sentence of the body.
Common terms such as CPU, GPU, PC, API, and UI usually 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/core or crates/adaptive must 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 NVIDIA in all caps. Do not use Nvidia, nvidia, or NV.

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.
Use can for possibility and reserve may for permission.
Use after for temporal relationships instead of once.
Prefer refer to over see when 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/adaptive aligned 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/core or crates/adaptive changed, 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!

Comment on lines +371 to +396
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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 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.

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

Labels

Documentation documentation-related size:M PR is medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants