migrate
Installation
SKILL.md
Migrate to AgentControl
You're using a skill that will guide you through migrating an application from hardcoded LLM prompts to a full LaunchDarkly AgentControl implementation. Your job is to run the migration in five stages, stopping at each stage for the user to confirm:
- Audit the code — read-only scan that produces a structured list of everything hardcoded (prompt, model, parameters, tools, app-scoped knobs).
- Wrap the call — install the SDK, create the config in LaunchDarkly, and route the provider call through
config().invoke(), keeping the original call as the fallback. - Move the tools — extract each tool's JSON schema, attach it to the config, and pass the implementations to the SDK as tool handlers.
- Verify metrics — confirm duration, tokens, and success/error reach the Monitoring tab, and add feedback or business metrics if the app needs them.
- Attach evaluators — either offline evals via the Playground + Datasets, or judges that score sampled traffic automatically.
⚠️ Three first-run failure modes to avoid.
- Placeholders with spaces. The SDK fills
{{name}}and{{user.name}}only.{{ name }}with spaces is sent to the model as literal text. Rewrite every placeholder without spaces in Stage 2.- No fallback.
invoke()has no fallback argument. It raisesRuntimeError(a plainErrorin Node.js) when the variation is disabled, the config key doesn't exist, or LaunchDarkly is unreachable. Keep the original hardcoded call and run it from anexcept RuntimeErrorbranch after checkingif (await inspect_config(key, context))["enabled"]: raise(so mid-run handler errors still propagate), or the app goes down with LaunchDarkly.- Fallthrough not flipped after
/configs-create. A freshly created config's fallthrough points at an auto-generated disabled variation, so everyinvoke()raises until/configs-targetingruns. Flip it before Stage 2 verification.
How the current SDK changes the migration
The SDK now owns the provider call. You evaluate a config and invoke it in one step, and a handler calls the provider. Metrics are recorded on every call, so there's no tracker to create or scope. What that means for each stage: