Skip to content

feat(code): trust user-declared endpoints for cold-cache policies - #5462

Merged
Mason Daugherty (mdrxy) merged 2 commits into
mainfrom
mdrxy/code/cold-cache-trusted-endpoints
Aug 18, 2026
Merged

feat(code): trust user-declared endpoints for cold-cache policies#5462
Mason Daugherty (mdrxy) merged 2 commits into
mainfrom
mdrxy/code/cold-cache-trusted-endpoints

Conversation

@mdrxy

@mdrxy Mason Daugherty (mdrxy) commented Aug 13, 2026

Copy link
Copy Markdown
Member

Depends on #5439

Docs

Some users don't talk to model providers directly — they go through a gateway or corporate proxy (for example, LangSmith's gateway, or a company-internal relay). The cold-cache warning from #5439 stays silent for all of them, because it only trusts the provider's official API address. This PR adds a setting to say "my endpoint plays by the provider's rules," turning the warnings back on:

[warnings]
trusted_cache_endpoints = ["smith.langchain.com"]

One entry covers every provider routed through that endpoint — no need to repeat it per provider.


Why trust is per-endpoint, not global. The warning's dollar estimates are only accurate if the thing sitting between you and the provider passes your cache settings through untouched and keeps cached data for as long as the provider documents. A proxy that quietly drops those settings would make the warning's numbers fiction. So instead of one blanket "trust everything" switch, you name the specific endpoints you've verified, and everything else stays silent.

One case stays silent even on a trusted endpoint. LangSmith's gateway can translate between API formats — for example, you can send an OpenAI-shaped request and have it answered by an Anthropic model. During that translation, your cache settings get rewritten to a generic 5-minute cache (or dropped entirely), so the provider's documented cache behavior no longer applies and any estimate would be a guess. When dcode can see a request will take one of these translated routes (the model name carries a cross-provider prefix like openai:anthropic/claude-...), it skips the warning rather than show numbers built on wrong assumptions. Requests that stay in their own format — the normal case — are forwarded by the gateway byte-for-byte (verified against the gateway source), so their warnings remain exactly as accurate as going direct.

Test plan
  • Unit tests cover trusted-endpoint policy resolution, gateway same-format vs cross-format routes, lookalike-host rejection (notsmith.langchain.com, smith.langchain.com.evil.example), and malformed config tolerance.
  • App-level tests confirm a trusted gateway endpoint allows the warning through, and a cross-format gateway route suppresses it even when trusted.
  • Lint, type check, and the cold-cache/manifest suites pass.

@github-actions github-actions Bot added dcode Related to `deepagents-code` feature New feature/enhancement or request for one internal User is a member of the `langchain-ai` GitHub organization size: M 200-499 LOC labels Aug 13, 2026

@open-swe open-swe Bot 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.

Open SWE Review found 1 potential issue.

Open in WebView Open SWE trace

Comment thread libs/code/deepagents_code/cold_cache.py Outdated
@mdrxy
Mason Daugherty (mdrxy) force-pushed the mdrxy/code/cold-cache-trusted-endpoints branch from 484e9e0 to e4c26c5 Compare August 13, 2026 20:14
@github-actions github-actions Bot added size: L 500-999 LOC and removed size: M 200-499 LOC labels Aug 13, 2026

@open-swe open-swe Bot 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.

Open SWE Review found 1 potential issue.

Open in WebView Open SWE trace

Comment thread libs/code/deepagents_code/cold_cache.py
@github-actions github-actions Bot added size: XL 1000+ LOC and removed size: L 500-999 LOC labels Aug 14, 2026
Comment thread libs/code/deepagents_code/cold_cache.py Fixed
Comment thread libs/code/deepagents_code/cold_cache.py Fixed
Comment thread libs/code/tests/unit_tests/test_cold_cache.py Dismissed
@mdrxy
Mason Daugherty (mdrxy) force-pushed the mdrxy/code/cold-cache-warning branch from 1cdc2fe to e6fe7b3 Compare August 17, 2026 05:40
@mdrxy
Mason Daugherty (mdrxy) force-pushed the mdrxy/code/cold-cache-trusted-endpoints branch from f751d78 to 66d31d3 Compare August 17, 2026 05:52
@mdrxy
Mason Daugherty (mdrxy) force-pushed the mdrxy/code/cold-cache-warning branch from e6fe7b3 to dd4d340 Compare August 17, 2026 06:00
@mdrxy
Mason Daugherty (mdrxy) force-pushed the mdrxy/code/cold-cache-trusted-endpoints branch from 66d31d3 to 414aeaa Compare August 17, 2026 06:00
@mdrxy
Mason Daugherty (mdrxy) force-pushed the mdrxy/code/cold-cache-warning branch from dd4d340 to 07c156a Compare August 17, 2026 06:17
@mdrxy
Mason Daugherty (mdrxy) force-pushed the mdrxy/code/cold-cache-trusted-endpoints branch from 414aeaa to 687b1cb Compare August 17, 2026 06:17

@open-swe open-swe Bot 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.

Open SWE Review found 1 potential issue.

Open in WebView Open SWE trace

Comment thread libs/code/deepagents_code/app.py

@open-swe open-swe Bot 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.

Open SWE Review found 1 potential issue.

Open in WebView Open SWE trace

Comment thread libs/code/deepagents_code/configurable_model.py
@mdrxy
Mason Daugherty (mdrxy) force-pushed the mdrxy/code/cold-cache-warning branch 2 times, most recently from 6a95f6b to a37a4c5 Compare August 18, 2026 01:34
@mdrxy
Mason Daugherty (mdrxy) force-pushed the mdrxy/code/cold-cache-trusted-endpoints branch 3 times, most recently from 2ae956b to 39a5231 Compare August 18, 2026 03:31
Base automatically changed from mdrxy/code/cold-cache-warning to main August 18, 2026 03:41
@mdrxy
Mason Daugherty (mdrxy) force-pushed the mdrxy/code/cold-cache-trusted-endpoints branch from 39a5231 to ada1bb7 Compare August 18, 2026 03:45
@mdrxy
Mason Daugherty (mdrxy) merged commit 107980e into main Aug 18, 2026
56 checks passed
@mdrxy
Mason Daugherty (mdrxy) deleted the mdrxy/code/cold-cache-trusted-endpoints branch August 18, 2026 03:49
Mason Daugherty (mdrxy) added a commit to langchain-ai/docs that referenced this pull request Aug 18, 2026
…#5524)

Draft documentation for two `deepagents-code` features:

-
[langchain-ai/deepagents#5439](langchain-ai/deepagents#5439)
— warn before expensive cold-cache turns
-
[langchain-ai/deepagents#5462](langchain-ai/deepagents#5462)
— trust user-declared endpoints for cold-cache policies

Generated with AI assistance (Deep Agents Code).
Mason Daugherty (mdrxy) pushed a commit that referenced this pull request Aug 18, 2026
> [!CAUTION]
> Merging this PR will automatically publish to **PyPI** and create a
**GitHub release**.

For the full release process, see
[`.github/RELEASING.md`](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md).

---

_Release notes preview: keep this section in sync with the package
`CHANGELOG.md`. Publish reads the merged CHANGELOG via `release.yml`,
not this PR description — keep them aligned anyway so the PR stays an
accurate historical record for reviewers and anyone returning later._

---


##
[0.1.57](deepagents-code==0.1.56...deepagents-code==0.1.57)
(2026-08-18)

### Features

- Added warnings before expensive cold-cache turns and trust
user-declared endpoints for cold-cache policies
([#5439](#5439),
[#5462](#5462)).
- Made the chat input resizable by dragging its top border
([#5524](#5524)).
- Added a `multi_select` question type to `ask_user`
([#5097](#5097)).
- Added support for ACP approval modes
([#5394](#5394)).
- Added `DeepSeek-V4-Pro-0813` to the model picker
([#5512](#5512)).
- Show conversation turns alongside message counts
([#5571](#5571)).
- Include `TERM_PROGRAM` in the resume hint
([#5548](#5548)).

### Bug Fixes

- Report total context after `/offload`
([#5488](#5488)).
- Fixed transcript and thread restoration issues, including hydration
lag, scrolling resumed threads to the bottom, and hiding empty
previous-thread hints
([#5479](#5479),
[#5543](#5543),
[#5552](#5552)).
- Fixed Auto-mode approval handling by binding “yes” to the paired
`ask_user` question and avoiding duplicate Auto denial notices
([#5038](#5038),
[#5501](#5501)).
- Improved reload behavior by keeping the chat input responsive during
`/reload`, reporting MCP server changes, and avoiding plugin reload
prompt flashes or startup hints
([#5529](#5529),
[#5504](#5504),
[#5500](#5500),
[#5502](#5502)).
- Improved dependency update UI by preserving editable fields and hiding
dependency details after updates
([#5521](#5521),
[#5519](#5519)).
- Fixed chat UI polish issues, including detached spacer mount anchors,
the unfocused input cursor, and relative timestamp toggle display
([#5516](#5516),
[#5258](#5258),
[#5503](#5503)).
- Refresh the splash version after updates
([#5520](#5520)).

_End release notes preview._

---

> [!NOTE]
> A **community contributors** list and a **Special thanks** section
(crediting the users who filed the issues this release's PRs closed) are
appended to the GitHub release notes automatically at publish time (see
[Release
Pipeline](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md#release-pipeline),
step 3).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: langchain-oss-automated-triage[bot] <248757908+langchain-oss-automated-triage[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dcode Related to `deepagents-code` feature New feature/enhancement or request for one internal User is a member of the `langchain-ai` GitHub organization size: XL 1000+ LOC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants