Skip to content

feat: add tools with instructions and examples to completion and agent config types#1175

Draft
ld-paul wants to merge 2 commits intomainfrom
devin/1773277027-add-tool-instructions-examples
Draft

feat: add tools with instructions and examples to completion and agent config types#1175
ld-paul wants to merge 2 commits intomainfrom
devin/1773277027-add-tool-instructions-examples

Conversation

@ld-paul
Copy link

@ld-paul ld-paul commented Mar 12, 2026

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

Part of a coordinated multi-repo change to add instructions and examples fields to AI Tools:

Describe the solution you've provided

Adds a new LDTool interface and wires tools through both completion and agent configuration types so the SDK can surface tool metadata (including the new instructions and examples fields) returned by the LaunchDarkly API.

Changes:

  • types.ts: New LDTool interface with key, version, instructions?, examples?, customParameters?. Added optional tools array to LDAIAgentConfigDefault, LDAIAgentConfig, LDAICompletionConfigDefault, and LDAICompletionConfig.
  • LDAIConfigUtils.ts: Added tools to the internal LDAIConfigFlagValue interface, toFlagValue() conversion (default → flag value), toCompletionConfig(), and toAgentConfig() conversions (flag value → config).
  • LDAIClientImpl.test.ts: 6 new tests covering tools on both completion configs (3 tests) and agent configs (3 tests): tools from variation, tools from defaults, and undefined tools scenarios.

Updates since last revision

  • Tools are now available on both completion and agent configs (previously agent-only)
  • Added 6 new test cases in LDAIClientImpl.test.ts — all 103 tests pass
  • toCompletionConfig() now includes tools: flagValue.tools

⚠️ Items for reviewer

  1. Verify LDTool shape matches backend contractkey, version, instructions?, examples?, customParameters?. Confirm this aligns with the Gonfalon API response.
  2. No runtime validation of tool data — Tool arrays from flag values are passed through without runtime validation, consistent with how other fields (messages, model, etc.) are handled in this SDK.
  3. Public API surfaceLDTool is exported via export * from types.ts through index.ts. Confirm this is the desired public API shape.

Describe alternatives you've considered

  • Could add tools at the base LDAIConfig level instead of on completion and agent configs separately, but judge configs do not use tools.
  • Could add runtime type validation for the tools array, but that would be inconsistent with the existing pattern for other fields.

Additional context


Note

Medium Risk
Additive but public API/type changes and config serialization/deserialization updates could impact consumers or compatibility with backend flag payloads if the LDTool shape diverges.

Overview
AI configs can now surface tool metadata (including optional instructions, examples, and customParameters) on both completion and agent configurations.

This adds a new exported LDTool type and threads an optional tools array through the default/config interfaces and the LDAIConfigUtils flag-value conversions (toFlagValue, toCompletionConfig, toAgentConfig). Test coverage is expanded with new cases verifying tools are preserved from flag variations and defaults, and omitted when not provided.

Written by Cursor Bugbot for commit 1baf4a0. This will update automatically on new commits. Configure here.

Co-Authored-By: Paul Loeb <ploeb@launchdarkly.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@github-actions
Copy link
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25566 bytes
Compressed size limit: 26000
Uncompressed size: 125383 bytes

@github-actions
Copy link
Contributor

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

@github-actions
Copy link
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 24534 bytes
Compressed size limit: 25000
Uncompressed size: 84907 bytes

@github-actions
Copy link
Contributor

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

Co-Authored-By: Paul Loeb <ploeb@launchdarkly.com>
@devin-ai-integration devin-ai-integration bot changed the title feat: add tools with instructions and examples to agent config types feat: add tools with instructions and examples to completion and agent config types Mar 12, 2026
@devin-ai-integration
Copy link
Contributor

Note: This PR needs the devin-pr label added.

@ld-paul ld-paul marked this pull request as ready for review March 12, 2026 01:56
@ld-paul ld-paul requested a review from a team as a code owner March 12, 2026 01:56
@jsonbailey jsonbailey self-requested a review March 12, 2026 14:09
@jsonbailey jsonbailey marked this pull request as draft March 13, 2026 14:12
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