feat: add tools with instructions and examples to completion and agent config types#1175
feat: add tools with instructions and examples to completion and agent config types#1175
Conversation
Co-Authored-By: Paul Loeb <ploeb@launchdarkly.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/browser size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/js-client-sdk-common size report |
Co-Authored-By: Paul Loeb <ploeb@launchdarkly.com>
|
Note: This PR needs the |
Requirements
Related issues
Part of a coordinated multi-repo change to add
instructionsandexamplesfields to AI Tools:Describe the solution you've provided
Adds a new
LDToolinterface and wires tools through both completion and agent configuration types so the SDK can surface tool metadata (including the newinstructionsandexamplesfields) returned by the LaunchDarkly API.Changes:
types.ts: NewLDToolinterface withkey,version,instructions?,examples?,customParameters?. Added optionaltoolsarray toLDAIAgentConfigDefault,LDAIAgentConfig,LDAICompletionConfigDefault, andLDAICompletionConfig.LDAIConfigUtils.ts: Addedtoolsto the internalLDAIConfigFlagValueinterface,toFlagValue()conversion (default → flag value),toCompletionConfig(), andtoAgentConfig()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
LDAIClientImpl.test.ts— all 103 tests passtoCompletionConfig()now includestools: flagValue.toolsLDToolshape matches backend contract —key,version,instructions?,examples?,customParameters?. Confirm this aligns with the Gonfalon API response.messages,model, etc.) are handled in this SDK.LDToolis exported viaexport *fromtypes.tsthroughindex.ts. Confirm this is the desired public API shape.Describe alternatives you've considered
LDAIConfiglevel instead of on completion and agent configs separately, but judge configs do not use tools.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
LDToolshape diverges.Overview
AI configs can now surface tool metadata (including optional
instructions,examples, andcustomParameters) on bothcompletionandagentconfigurations.This adds a new exported
LDTooltype and threads an optionaltoolsarray through the default/config interfaces and theLDAIConfigUtilsflag-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.