Skip to content

feat: fall back to model.parameters.tools when root tools absent#1330

Open
jsonbailey wants to merge 7 commits intomainfrom
jb/aic-1935/tools-model-params-fallback
Open

feat: fall back to model.parameters.tools when root tools absent#1330
jsonbailey wants to merge 7 commits intomainfrom
jb/aic-1935/tools-model-params-fallback

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

@jsonbailey jsonbailey commented Apr 28, 2026

Summary

  • Adds _resolveTools() to LDAIConfigUtils — checks root-level tools first, falls back to model.parameters.tools for older AI configs
  • Root-level tools always takes priority when present
  • model.parameters.tools as an array or non-object is silently ignored (may be user-defined custom param)
  • Entries missing a name string are silently skipped; valid entries in the same map are still returned

Background

The LaunchDarkly AI Config API now sends tools in two places: updated configs send them at both root and model.parameters.tools; older configs only send them in model.parameters.tools. Previously the SDK only read root-level, leaving older configs with no tools.

Test plan

  • Existing tools tests pass
  • Tools parsed from model.parameters.tools when root key is absent
  • Root tools wins when both locations are present
  • model.parameters.tools as array → undefined
  • Entries missing name skipped; valid entries in same map returned

Jira: AIC-1935

🤖 Generated with Claude Code


Note

Medium Risk
Changes how tools are derived for agent/completion configs by parsing and normalizing tool maps from multiple locations, which may affect downstream tool execution when flags contain unexpected shapes. Adds warnings for invalid tool payloads, but scope is limited to config parsing.

Overview
Adds backwards-compatible tool resolution for AI configs: tools is now taken from the root tools map when present, otherwise parsed from model.parameters.tools.

Introduces map parsing/normalization (including defaulting missing tool name to the map key) and emits logger warnings when tools is present but not an object. Updates LDAIClientImpl to pass the SDK logger into LDAIConfigUtils, and expands tests to cover fallback/precedence and invalid model.parameters.tools shapes.

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

When root-level tools is absent, fall back to model.parameters.tools and
parse it as our LDTool map format. Arrays or entries missing a name field
are silently ignored.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25623 bytes
Compressed size limit: 29000
Uncompressed size: 125843 bytes

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 38473 bytes
Compressed size limit: 39000
Uncompressed size: 211104 bytes

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31840 bytes
Compressed size limit: 34000
Uncompressed size: 113634 bytes

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179547 bytes
Compressed size limit: 200000
Uncompressed size: 830815 bytes

@jsonbailey jsonbailey changed the title feat(server-ai): fall back to model.parameters.tools when root tools absent feat: fall back to model.parameters.tools when root tools absent Apr 28, 2026
jsonbailey and others added 4 commits April 29, 2026 10:08
…s bad entries

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…root tools path, fall back to key name when name field absent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jsonbailey jsonbailey marked this pull request as ready for review April 30, 2026 14:43
@jsonbailey jsonbailey requested a review from a team as a code owner April 30, 2026 14:43
Comment thread packages/sdk/server-ai/src/api/config/LDAIConfigUtils.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 76068a6. Configure here.

Comment thread packages/sdk/server-ai/src/api/config/LDAIConfigUtils.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.

1 participant