Avatar for the langchain-ai user
langchain-ai
langchain
BlogDocsChangelog

Performance History

Latest Results

fix(anthropic, openai): never close shared/cached httpx pools on aclose() The first cut of close()/aclose() unconditionally closed the SDK client's underlying httpx pool. But both integrations back their clients with a PROCESS-WIDE SHARED pool via @lru_cache (`_get_default_*httpx_client`): every model with the same base_url/timeout/proxy reuses one pool by design. Closing it from a single model's teardown broke every other live model in the process — observed in a long-lived worker as: RuntimeError: Cannot send a request, as the client has been closed. -> anthropic.APIConnectionError: Connection error. Fix: close()/aclose() now release the underlying httpx client ONLY when the model privately owns it; the shared cached pool and user-supplied clients are left intact. - anthropic: `ChatAnthropic` always wraps the shared cached pool (it has no http_client field), so close()/aclose() are effectively no-ops for the pool. An identity check against the lru-cache getter (`_wraps_shared_httpx`) guards a hypothetical future private-client path. `_http_client_params()` is factored out so the cached_property builders and the identity check stay in sync. - openai: ownership is computed in `validate_environment` and stored on `_owns_sync_http_client` / `_owns_async_http_client`. A client is owned iff the model built it privately — the unhashable-`httpx.Timeout` fresh-client path or an `openai_proxy` transport — and the user did not supply their own `http_client` / `http_async_client`. Default (shared cache) and user-supplied clients are never closed. Tests rewritten to pin the invariant: a regression test builds two default models, closes one, and asserts the other's shared pool is still open; plus owned-path and user-injected-not-closed cases. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat/chat-model-aclose
19 hours ago
cr
mdrxy/release-anthropic-1-4-4
19 hours ago
pin langgraph to PR #7928 branch for CI
nh/subagent-projection
1 day ago

Latest Branches

CodSpeed Performance Gauge
0%
feat(core, anthropic, openai): aclose() lifecycle + latched fallbacks#37718
19 hours ago
e0ace82
feat/chat-model-aclose
CodSpeed Performance Gauge
0%
release(anthropic): 1.4.4#37757
19 hours ago
6c9acd2
mdrxy/release-anthropic-1-4-4
CodSpeed Performance Gauge
0%
© 2026 CodSpeed Technology
Home Terms Privacy Docs