Skip to content

fix(AIC-3382): support Bedrock configs in LangChain handlers - #72

Merged
andrewklatzke merged 4 commits into
mainfrom
aklatzke/AIC-3382/langchain-bedrock-fixes
Sep 18, 2026
Merged

andrewklatzke merged 4 commits into
mainfrom
aklatzke/AIC-3382/langchain-bedrock-fixes

Conversation

@andrewklatzke

@andrewklatzke andrewklatzke commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

TypeScript counterpart to launchdarkly/python-ai-sdk#101. Three fixes for LangChain handlers (langchain-agents and langchain-messages):

  • Bedrock configs with no explicit llm now instantiate @langchain/aws's ChatBedrockConverse instead of falling through to ChatOpenAI. Model parameters and the region-prefixed model ID are forwarded. @langchain/aws is an optional peer dependency, with a clear install error when absent.
  • For Bedrock, model.region is prepended to the model ID as an inference-profile prefix. Prefixing is idempotent and applies to default constructors and user-supplied factories without mutating the caller's config.
  • gen_ai.provider.name now reports the configured provider lower-cased rather than collapsing non-Anthropic providers to OpenAI. gen_ai.system remains langchain.

The streaming example also falls back to the final response when no chunk events are emitted.

Test plan

  • Unit tests for both LangChain handlers, including Bedrock default construction, region prefixing, and factory config handling
  • Integration scenarios for success and failure paths
  • Biome and TypeScript checks

Jira: AIC-3382


Note

Overview
Adds AWS Bedrock as a first-class default model path for the langchain-agents and langchain-messages handlers: Bedrock configs without a custom llm now build ChatBedrockConverse via dynamic @langchain/aws import (optional peer; clear error if missing).

Bedrock model IDs get model.region prepended once as an inference-profile prefix (us.model…), without double-prefixing or mutating the caller’s config; factories receive a shallow copy with the resolved name. Bedrock constructor args drop tools from model.parameters so tool wiring stays on the agent/handler side.

OpenTelemetry gen_ai.provider.name is now the configured provider name lower-cased (empty → openai), not only anthropic vs openai; gen_ai.system stays langchain.

The streaming example prints the final response when no chunk events arrive, and logs usage/judge results on stdout instead of stderr debug noise.

Reviewed by Cursor Bugbot for commit fc1079d. Bugbot is set up for automated code reviews on this repo. Configure here.

andrewklatzke and others added 2 commits September 18, 2026 11:22
Apply inference-profile prefixes before model construction and report the configured provider so Bedrock calls and telemetry stay aligned.

Co-authored-by: Cursor <cursoragent@cursor.com>
Route Bedrock configs through ChatBedrockConverse so callers no longer need to provide a custom model factory.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread packages/langchain-messages/src/__tests__/spans.test.ts
*/
function servingProvider(config: AiConfigRep): string {
return (config.provider?.name ?? '').toLowerCase() === 'anthropic' ? 'anthropic' : 'openai';
return (config.provider?.name || 'openai').toLowerCase();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it enough to just lowercase them, or should we add a mapping function? Obviously Anthropic -> anthropic and OpenAI -> openai will be fine, but what about some of the others, like "IBM Watson"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for the telemetry information, so I think that should be fine

Prevent payload-owned tool definitions from leaking into ChatBedrockConverse constructor arguments while preserving the evaluated config.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andrewklatzke

Copy link
Copy Markdown
Contributor Author
Screenshot 2026-09-18 at 1 06 30 PM

Confirmed bedrock call via langchain in my sample app with my orchestrator

Print usage and judges on stdout and drop leftover debug logs so both samples behave the same.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andrewklatzke
andrewklatzke merged commit a1487cf into main Sep 18, 2026
8 checks passed
@andrewklatzke
andrewklatzke deleted the aklatzke/AIC-3382/langchain-bedrock-fixes branch September 18, 2026 21:24
@github-actions github-actions Bot mentioned this pull request Sep 17, 2026
andrewklatzke pushed a commit that referenced this pull request Sep 22, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>@launchdarkly/ai-server: 0.3.0</summary>

##
[0.3.0](https://github.com/launchdarkly/js-ai-sdk/compare/@launchdarkly/ai-server-0.2.0...@launchdarkly/ai-server-0.3.0)
(2026-09-18)


### Features

* **AIC-3106:** add multimodal history support to graph().invoke()
([#18](#18))
([9737530](9737530))
* **client:** stamp modelKey and modelVersion from _ldMeta on tracking
events
([758fe7c](758fe7c))
* **client:** stamp modelKey and modelVersion from _ldMeta on tracking
events ([#66](#66))
([89e4f0e](89e4f0e))


### Bug Fixes

* **client:** harden model stamps, share node trackData builder, keep
judge results from inheriting parent model identity
([d374962](d374962))
* **client:** reject blank-string modelVersion and non-string modelKey
in model stamps
([f80c016](f80c016))
* extract LangChain content-block text and apply model parameters after
eval ([#54](#54))
([e34e779](e34e779))
* **graph:** prefer node tools before synthetic handoff routing
([#59](#59))
([0578819](0578819))
* **telemetry:** a tool that returned nothing did not return null
([#21](#21))
([92cfcee](92cfcee))
</details>

<details><summary>@launchdarkly/ai-claude-agents: 0.3.0</summary>

##
[0.3.0](https://github.com/launchdarkly/js-ai-sdk/compare/@launchdarkly/ai-claude-agents-0.2.0...@launchdarkly/ai-claude-agents-0.3.0)
(2026-09-18)


### Features

* **AIC-3106:** add multimodal history support to graph().invoke()
([#18](#18))
([9737530](9737530))
* **client:** stamp modelKey and modelVersion from _ldMeta on tracking
events
([758fe7c](758fe7c))
* **client:** stamp modelKey and modelVersion from _ldMeta on tracking
events ([#66](#66))
([89e4f0e](89e4f0e))


### Bug Fixes

* **client:** harden model stamps, share node trackData builder, keep
judge results from inheriting parent model identity
([d374962](d374962))
</details>

<details><summary>@launchdarkly/ai-claude-messages: 0.3.0</summary>

##
[0.3.0](https://github.com/launchdarkly/js-ai-sdk/compare/@launchdarkly/ai-claude-messages-0.2.0...@launchdarkly/ai-claude-messages-0.3.0)
(2026-09-18)


### Features

* **AIC-3106:** add multimodal history support to graph().invoke()
([#18](#18))
([9737530](9737530))
</details>

<details><summary>@launchdarkly/ai-openai-agents: 0.3.0</summary>

##
[0.3.0](https://github.com/launchdarkly/js-ai-sdk/compare/@launchdarkly/ai-openai-agents-0.2.0...@launchdarkly/ai-openai-agents-0.3.0)
(2026-09-18)


### Features

* **AIC-3106:** add multimodal history support to graph().invoke()
([#18](#18))
([9737530](9737530))
* **client:** stamp modelKey and modelVersion from _ldMeta on tracking
events
([758fe7c](758fe7c))
* **client:** stamp modelKey and modelVersion from _ldMeta on tracking
events ([#66](#66))
([89e4f0e](89e4f0e))


### Bug Fixes

* **client:** harden model stamps, share node trackData builder, keep
judge results from inheriting parent model identity
([d374962](d374962))
</details>

<details><summary>@launchdarkly/ai-openai-messages: 0.3.0</summary>

##
[0.3.0](https://github.com/launchdarkly/js-ai-sdk/compare/@launchdarkly/ai-openai-messages-0.2.0...@launchdarkly/ai-openai-messages-0.3.0)
(2026-09-18)


### Features

* **AIC-3106:** add multimodal history support to graph().invoke()
([#18](#18))
([9737530](9737530))
</details>

<details><summary>@launchdarkly/ai-langchain-agents: 0.3.0</summary>

##
[0.3.0](https://github.com/launchdarkly/js-ai-sdk/compare/@launchdarkly/ai-langchain-agents-0.2.0...@launchdarkly/ai-langchain-agents-0.3.0)
(2026-09-18)


### Features

* **AIC-3106:** add multimodal history support to graph().invoke()
([#18](#18))
([9737530](9737530))
* **client:** stamp modelKey and modelVersion from _ldMeta on tracking
events
([758fe7c](758fe7c))
* **client:** stamp modelKey and modelVersion from _ldMeta on tracking
events ([#66](#66))
([89e4f0e](89e4f0e))


### Bug Fixes

* **AIC-3382:** support Bedrock configs in LangChain handlers
([#72](#72))
([a1487cf](a1487cf))
* **client:** harden model stamps, share node trackData builder, keep
judge results from inheriting parent model identity
([d374962](d374962))
* extract LangChain content-block text and apply model parameters after
eval ([#54](#54))
([e34e779](e34e779))
</details>

<details><summary>@launchdarkly/ai-langchain-messages: 0.3.0</summary>

##
[0.3.0](https://github.com/launchdarkly/js-ai-sdk/compare/@launchdarkly/ai-langchain-messages-0.2.0...@launchdarkly/ai-langchain-messages-0.3.0)
(2026-09-18)


### Features

* **AIC-3106:** add multimodal history support to graph().invoke()
([#18](#18))
([9737530](9737530))


### Bug Fixes

* **AIC-3382:** support Bedrock configs in LangChain handlers
([#72](#72))
([a1487cf](a1487cf))
* extract LangChain content-block text and apply model parameters after
eval ([#54](#54))
([e34e779](e34e779))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> **Release Please cut** that bumps `@launchdarkly/ai-server` and the
Claude, OpenAI, and LangChain agent/message packages from **0.2.0 →
0.3.0**, updates `.release-please-manifest.json`, embedded
`LD_AI_PACKAGE_VERSION` constants, and adds **0.3.0** changelog sections
(no runtime code in this diff).
> 
> The **0.3.0** notes capture already-merged work: **multimodal
conversation history** on `graph().invoke()`, **modelKey/modelVersion**
on tracking events from `_ldMeta` (with validation and judge events not
inheriting parent model identity), plus fixes for **graph tool
routing**, **LangChain** text extraction / post-eval model params and
**Bedrock** configs, and **telemetry** for empty tool results.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
6130d2c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants