Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

legacy-sdk-migrate

БесплатноБез исполняемых скриптовНе проверен

Migrate an app from the legacy LaunchDarkly AI SDKs (Python `launchdarkly-server-sdk-ai` / `ldai`, Node.js `@launchdarkly/server-sdk-ai`, Go…

launchdarklyот launchdarkly★ 32 звезды на GitHub

Об этом скилле

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

  1. Inventory before you edit. Find every legacy import and call site first, and confirm the list with the user.
  2. Use the real export names. Handler factories are create_<provider>_<mode>_handler() in Python and create<Provider><Mode>Handler() in Node (createOpenAIMessagesHandler, createOpenAIAgentsHandler, create_openai_agents_handler). Check the installed package's exports before writing an import; don't guess.
  3. Keep the fallback. The current SDKs take no fallback argument. invoke() raises when the variation is disabled (targeting off) or LaunchDarkly is unreachable, so every call site that relied on enabled=False defaults needs an explicit try/except (or try/catch) that preserves today's degraded behavior.
  4. Delete, don't wrap. Remove trackers, track_* calls, provider-client construction, message merging, and model=config.model.name plumbing. Leaving them in double-counts metrics.
  5. Register once. Put handlers and tool implementations in one Registry (or the global registry) instead of rebuilding them at every call site.
  6. Ask before rewriting business logic. If the app post-processes provider-specific response objects (for example completion.choices[0].message.content), switch to result.response, and ask before changing anything downstream that depends on the raw provider object.

Workflow

Step 1: Explore (read-only)

Find every legacy usage. Search for these patterns and record file and line for each hit:

Language Imports and packages Calls
Go github.com/launchdarkly/go-server-sdk-ai/ldai (including /judge, /datamodel), older github.com/launchdarkly/go-server-sdk/ldai; inspect go.mod, go.sum, and aliased imports NewClient, Config, CompletionConfig, CompletionConfigTemplate, AgentConfig, AgentConfigTemplate, AgentConfigs, JudgeConfig, JudgeConfigTemplate, AgentGraph, CreateTracker, CreateGraphTracker, GraphTracker, TrackMetricsOf, TrackRequest, TrackDurationOf, TrackDuration, TrackTokens, TrackUsage, TrackSuccess
Полный SKILL.md на GitHub

Установить legacy-sdk-migrate в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/api-mapping.mdreferences/go-api-mapping.md

FAQ

Что делает скилл legacy-sdk-migrate?

Migrate an app from the legacy LaunchDarkly AI SDKs (Python `launchdarkly-server-sdk-ai` / `ldai`, Node.js `@launchdarkly/server-sdk-ai`, Go `go-server-sdk-ai/ldai` or `go-server-sdk/ldai`) to the current handler-based AI SDKs (`launchdarkly-ai-server`, `@launchdarkly/ai-node` / `@launchdarkly/ai-server`, `github.com/launchdarkly/go-ai-sdk` plus handlers). Use when code calls `LDAIClient`, `initAi`, `ldai.NewClient`, `CompletionConfig`, `AgentConfig`, `AgentGraph`, `CreateTracker`, `completion_config` / `completionConfig`, `agent_config` / `agentConfig`, `agent_configs`, `create_tracker` / `trackMetricsOf`, `create_judge`, `create_model`, or `agent_graph`, or when the user asks to upgrade between LaunchDarkly AI SDKs. For apps with hardcoded LLM prompts that aren't on LaunchDarkly yet, use `migrate` instead.

Как установить скилл legacy-sdk-migrate?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл legacy-sdk-migrate запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить legacy-sdk-migrate с