feat(misc): add multi-agent shared-context prompt caching notebook#707
Open
hipvlady wants to merge 1 commit into
Open
feat(misc): add multi-agent shared-context prompt caching notebook#707hipvlady wants to merge 1 commit into
hipvlady wants to merge 1 commit into
Conversation
Caching a shared context block across a planner/worker/reviewer pipeline, and the prefix-mutation crossover where re-writing the cache stops paying. Cost-model and crossover cells run with no API key; the live demo is guarded. Adds registry.yaml and authors.yaml entries. Implements anthropics#596.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a notebook under
misc/on shared-context prompt caching across a multi-agent pipeline (planner → worker → reviewer), focused on the case the existingmisc/prompt_caching.ipynbdoesn't cover: what happens to caching economics when the shared prefix mutates between steps.It:
cache_controland reads cost offusage;Implements the proposal in #596, reworked around the mutation-cost crossover that came up in the discussion there.
Notes
claude-haiku-4-5for the one live call. The shared context is sized above Haiku's 4096-token cache minimum so caching actually engages (and the notebook calls out verifyingcache_read_input_tokens > 0).ANTHROPIC_API_KEYand left unexecuted, with an adjacent "what you'll see" markdown cell, per the external-contributor testing note inCONTRIBUTING.md.registry.yamlentry and anauthors.yamlentry (kept sorted).Test plan
ruff checkandruff format --checkcleanscripts/validate_notebooks.pypasses (no empty cells, no error outputs)scripts/validate_authors_sorted.pypasses.github/registry_schema.jsonusagenumbers