Calls braintrust.auto_instrument(), which patches langchain_core.tracers.context to install a global BraintrustCallbackHandler. After that, every chain run is traced with no config={"callbacks": [...]} plumbing required — the trace shows the RunnableSequence task span with ChatPromptTemplate and ChatOpenAI children.
export BRAINTRUST_API_KEY=... export OPENAI_API_KEY=... uv sync uv run python example.py
Use it to verify cache reads/writes and token totals on real Braintrust spans.
# Loads BRAINTRUST_API_KEY and ANTHROPIC_API_KEY from ../../.env automatically.
uv sync
uv run python anthropic_prompt_cache.pyTo inspect the logged spans with the Braintrust CLI:
bt projects list --json | jq '.[] | select(.name == "z-abhi-langchain-anthropic-cache-demo")' bt view logs --object-ref project_logs:<project-id> --list-mode spans --limit 10 --json