pypi / langchain-cloudflare
langchain-cloudflare
What changed in langchain-cloudflare 0.4, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-31.
13 new APIs and options2 behavior and defaults2 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initlangchain-cloudflare 0.417 changes
New APIs and options 13
Supports @cf/cloudflare/clairic through synchronous REST, asynchronous REST, and Python Workers AI bindings, with native field definitions, reference dates, and extraction options.
Pass Clef or Clairic with response_format to receive a validated Pydantic instance in structured_response, with automatic, provider-format, and single-schema tool-format strategies.
The Worker extraction endpoint forwards native text and image extraction requests through the existing AI binding.
Embedded PNG, JPEG, and WebP inputs accept data URLs or content_type/base64 objects, including image-only requests.
Clef and Clairic expose native Pydantic structured output with LangChain Runnable sync, async, and batch methods; unsupported schema shapes are rejected before inference.
Clef Omni accepts optional audio inputs in WAV or MP3 format as embedded data URLs or content_type/base64 objects alongside text, JSON, and images.
Supports @cf/cloudflare/clef-omni through synchronous REST, asynchronous REST, and Python Workers AI bindings, preserving native answers, probabilities, and token usage.
Clef Omni accepts optional video inputs in MP4 or WebM format as embedded data URLs or content_type/base64 objects alongside text, JSON, and images.
Adds a list of Workers AI candidates for the Auto Router; REST calls send it through cf-aig-allowed-models and Worker binding calls use extraHeaders.
Adds optional session and turn controls for Auto Router through aig_session_id, aig_turn_id, and aig_no_session_affinity fields.
REST calls using Auto Router require endpoint_format="openai_compatible".
Supports the cloudflare/auto model route when an explicit list of Workers AI candidates is provided.
Auto Router responses report the serving model in model_name and the requested route in requested_model.
Behavior and default changes 2
Native structured agents return the validated Pydantic instance in structured_response.
REST and Python Worker responses include routing reason and request identifiers when AI Gateway returns those headers; Worker binding uses returnRawResponse to read them.
Fixes and other changes 2
Older Clef models reject audio and video arguments before calling the provider.
Python Worker AI binding session affinity and Auto Router candidate headers now use the documented extraHeaders option.