Skip to content

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

Merged
jsonbailey merged 6 commits intomainfrom
jb/aic-1935/tools-model-params-fallback
Apr 29, 2026
Merged

feat: fall back to model.parameters.tools when root tools absent#146
jsonbailey merged 6 commits intomainfrom
jb/aic-1935/tools-model-params-fallback

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

@jsonbailey jsonbailey commented Apr 28, 2026

Summary

  • Adds _resolve_tools() to client.py — 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 a list or non-dict is silently ignored (may be user-defined custom param)
  • Entries that are not dicts 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 list → None
  • Non-dict entries skipped; valid entries in same map returned

Jira: AIC-1935

🤖 Generated with Claude Code


Note

Low Risk
Small, localized change to tool parsing/resolution with added tests; risk is limited to how tools are discovered from evaluated flag variations.

Overview
Adds backward-compatible tool resolution so completion_config and agent_config can load tools from model.parameters.tools when the root-level tools field is missing, while keeping root tools as the source of truth when both are present.

Tightens tool parsing with warnings when tools/model.parameters.tools are present but not dicts, and expands test_tools.py coverage for fallback behavior, precedence, list/non-dict rejection, and skipping invalid tool entries.

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

When a flag variation has no root-level `tools` key, resolve tools from
`variation['model']['parameters']['tools']` instead. Root-level presence
always takes priority; the model-params fallback is entirely silent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@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
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jsonbailey jsonbailey marked this pull request as ready for review April 29, 2026 14:37
@jsonbailey jsonbailey requested a review from a team as a code owner April 29, 2026 14:37
Comment thread packages/sdk/server-ai/src/ldai/client.py
Comment thread packages/sdk/server-ai/src/ldai/client.py Outdated
jsonbailey and others added 2 commits April 29, 2026 09:54
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread packages/sdk/server-ai/src/ldai/client.py
jsonbailey and others added 2 commits April 29, 2026 10:18
…ools

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 da15718. Configure here.

Comment thread packages/sdk/server-ai/src/ldai/client.py
@jsonbailey jsonbailey merged commit 2c30d75 into main Apr 29, 2026
46 checks passed
@jsonbailey jsonbailey deleted the jb/aic-1935/tools-model-params-fallback branch April 29, 2026 16:07
@github-actions github-actions Bot mentioned this pull request Apr 28, 2026
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.

2 participants