legacy-sdk-migrate

Installation
SKILL.md

Migrate from the legacy AI SDKs

Go routing: This skill also migrates github.com/launchdarkly/go-server-sdk-ai/ldai and older github.com/launchdarkly/go-server-sdk/ldai apps to github.com/launchdarkly/go-ai-sdk v1.0.0 (Go 1.26+). Read references/go-api-mapping.md before editing Go. Follow its assess/execute instructions instead of the Python/Node APIs in Steps 2–3, Core Principles, and Edge Cases below. Keep the same inventory/approval gates and verification workflow. Go uses typed errors, explicit registries, context.Context and ldcontext.Context, not Python/Node signatures.

You're using a skill that will guide you through moving an application from the legacy LaunchDarkly AI SDKs to the current handler-based AI SDKs. Your job is to inventory every legacy call site, map each one to its current equivalent, rewrite the code, and verify that the app still behaves the same, including when LaunchDarkly is unreachable.

The current SDKs are not drop-in replacements. In the legacy SDKs the app evaluates a config, builds a provider client, merges messages, calls the provider, and wraps the call in a tracker. In the current SDKs the app registers handlers and tools once, then calls config(), graph(), or a handler package's convenience function. The SDK evaluates the config, routes to the handler that matches the variation's provider and mode, calls the provider, and records metrics and OpenTelemetry spans.

Source guide: Migrate from the legacy AI SDKs. Full before/after code for every pattern: references/api-mapping.md.

Prerequisites

  • The app already uses a legacy AI SDK, and its AgentControl configs (formerly AI Configs) already exist in LaunchDarkly. The config keys, variations, tools, and judges carry over unchanged; this is a code migration only. (If the app calls an LLM provider directly with hardcoded prompts and does not use LaunchDarkly yet, use the migrate skill instead.)
  • LD_SDK_KEY (server-side SDK key) and the provider API keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, ...) available as environment variables. The current SDKs read them from the environment.
  • Python: the current packages require Python 3.12 or later (launchdarkly-ai-server 1.0.0+), and the API is async (await config(...).invoke(...)). launchdarkly-server-sdk is required at runtime for standard initialization and ldclient.Context (installed via "launchdarkly-ai-server[ld]" / "launchdarkly-ai-python[ld]" or by keeping launchdarkly-server-sdk). Check Python 3.12+ before you start.
  • Node.js: @launchdarkly/ai-node 1.0.0+ for Node (bundles @launchdarkly/node-server-sdk); @launchdarkly/ai-server plus a pre-initialized client for edge or custom runtimes.

Core Principles

Installs
6
GitHub Stars
31
First Seen
5 days ago