Repository navigation
feat(agentcontrol): add legacy-sdk-migrate skill for moving to the handler-based AI SDKs - #250
tracisiebel wants to merge 9 commits into
Conversation
…ndler-based AI SDKs Co-Authored-By: Traci Siebel <traci@launchdarkly.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Skill eval results
Only suites whose source actually changed since their last recorded score were re-run. Soft-failing while we stabilise the baseline. |
…cy-ai-sdk-migration Co-Authored-By: Ben Woskow <bwoskow@launchdarkly.com> # Conflicts: # CHANGELOG.md
…, and tool/template details Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d7c0bf3. Configure here.
…ack re-raise, and judge track_data Co-authored-by: Cursor <cursoragent@cursor.com>
…, custom graph walks, and content capture Co-authored-by: Cursor <cursoragent@cursor.com>
jeffdupont
left a comment
There was a problem hiding this comment.
Approving. I tested the skill end to end. A fresh agent that saw only SKILL.md and references/api-mapping.md migrated two realistic legacy apps, one Python (launchdarkly-server-sdk-ai 1.2.0) and one Node.js (@launchdarkly/server-sdk-ai 2.0.20). Each app covers a completion config with variables, token/duration/success tracking, thumbs-up feedback, an agent with a hand-written tool loop, a disabled-config fallback, a judge and (Node) streaming.
- The migrated code passes
mypy --strictandtsc --strictagainst the publishedlaunchdarkly-ai-server1.1.0 and@launchdarkly/ai-server1.1.0 /@launchdarkly/ai-node1.0.1 with the OpenAI handlers. - Run against test-data flags and a local OpenAI stub, it returns the same results as the legacy code in every scenario, including the fallback. It emits the same LaunchDarkly metric events with the same values and track data: tokens, duration, success,
tool_call, and the feedback events throughget_client().track()/getClient().track(). Node streaming now also reports tokens. validate_skills.py, the catalog check and the new unit test pass. That test only checks that some phrases are present, so it doesn't exercise the examples.
Worth fixing (none block):
- Graph event keys (
SKILL.md:122,api-mapping.md:568). The current legacy SDKs already emit$ld:ai:graph:handoff_success/handoff_failure,invocation_success/invocation_failure,total_tokensand$ld:ai:tool_call, the same keys as 1.x (ldai/tracker.py:553-796; the same in the Node package). Only$ld:ai:graph:path→$ld:ai:graph:nodechanged, andredirectis gone. As written, the note tells users to rebuild metrics that already work. - Node background-judge example (
api-mapping.md:520).runJudge(task, handlers)useshandlerswithout defining it, unlike the Python example. Copied as is, it won't compile. - Python names in Node guidance.
setting_sourcesshould besettingSourcesforcreateClaudeAgentsHandler()(SKILL.md:124).graph.run_node/edge.target_keyshould berunNode/targetKeyin Node (SKILL.md:122,api-mapping.md:567-568). - Deleting the tool loop can silently lose behaviour (
api-mapping.md:338). If the app defined a tool's schema in code and the variation in LaunchDarkly doesn't have it, the migrated agent runs without the tool and nothing fails. A line asking the agent to confirm each tool exists on the variation would help. The same applies to a step cap or default model the old loop set. get_client().track()with a dict (SKILL.md:100). It isn't silently dropped. It raisesAttributeError: 'dict' object has no attribute 'valid'. The fix the skill gives,Context.from_dict(...), is right; only the description of the failure is off.
Nits:
- The Step 1 search list misses
track_judge_result/trackJudgeResult,trackToolCall(Node), the feedback enums, andAICompletionConfigDefault/AIAgentConfigDefault. - Judges attached to a variation run on every
invoke(). An app that judged only some calls on a config will now judge all of them, so mentioningskip_judgesthere would help. - In Node, the app's existing
LDContexttype from@launchdarkly/node-server-sdkdoesn't type-check as the context argument. A plain object literal does. - The branch conflicts with
maininCHANGELOG.mdandskills.json, so it needs a rebase before merge.
…cy-ai-sdk-migration Co-Authored-By: Traci Siebel <traci@launchdarkly.com> # Conflicts: # CHANGELOG.md # skills.json
…names, judge handlers, tool checks) Co-Authored-By: Traci Siebel <traci@launchdarkly.com>
|
@jeffdupont thanks for the end-to-end run. I addressed all of the review in f4f7015 and merged
Nits: the Step 1 search list now has
|

Summary
Adds
agentcontrol/legacy-sdk-migrate, an agent skill version of Migrate from the legacy AI SDKs, so customers can have an agent move them fromlaunchdarkly-server-sdk-ai/@launchdarkly/server-sdk-aito the current handler-based SDKs.LDAIClient,initAi,completion_config,agent_config, trackers, judges, graphs), map each to a convenience function,config().invoke(), orgraph(), then confirm no legacy references remaininit_client(), tools andRegistry, streaming andhistory, async judges (skip_judges+run_judge()), graphs (graph(),resolve_graph()+ native runners)invoke()raises when the variation is disabled, so the skill portsenabled=Falsebranches to error handling andinspect_config()/inspectConfig()references/api-mapping.md: before/after code in Python and Node.jsskills.jsonTesting
python3 scripts/validate_skills.py,python3 -m unittest discover -s tests,python3 scripts/generate_catalog.py --check, and(cd evals && npm test)all pass. API and package names checked againstlaunchdarkly/python-ai-sdkandlaunchdarkly/js-ai-sdksource.Notes
Details
createOpenAIHandler,createOpenAIAgentHandler, andcreate_openai_agent_handler, which aren't exported. The SDKs exportcreateOpenAIMessagesHandler,createOpenAIAgentsHandler, andcreate_openai_agents_handler. The skill uses the exported names and warns agents about the mismatch. The docs page should be fixed separately.track_feedback/trackFeedbackequivalent, so the skill tells the agent to flag the gap to the user instead of deleting those calls.agentcontrol/migrate, which moves hardcoded prompts into AgentControl. Related open PRs fix(migrate): roll forward to the new AI SDK #218, fix(built-in-metrics): roll forward to the new AI SDK #219, and fix(tools): roll forward to the new AI SDK #221 update other skills to the new SDK and don't overlap with this one..claude-plugin/plugin.jsonlist, matchingmigrate. Codex and Cursor pick it up from the directory.Link to Devin session: https://app.devin.ai/sessions/d950e07d53954b9880874f06e845ac40
Open in Devin Desktop: https://app.devin.ai/desktop/session/d950e07d53954b9880874f06e845ac40?variant=devin
Requested by: @tracisiebel
Note
Overview
Adds
agentcontrol/legacy-sdk-migrate0.1.0, an agent playbook for upgrading apps already onlaunchdarkly-server-sdk-ai/@launchdarkly/server-sdk-aito the handler-based SDKs (config().invoke(), handler packages,Registry,graph()).The skill follows Explore → Assess → Execute → Verify: inventory legacy APIs, map them to current patterns (including fallbacks via
inspect_config, durable background judges, andtrack_datafor feedback), and verify no legacy references remain.references/api-mapping.mdsupplies Python and Node before/after examples. The catalog is updated inskills.json,README.md(new row;migratedescription clarified as hardcoded-prompt onboarding), andCHANGELOG.md.tests/test_legacy_sdk_migrate.pyasserts the skill and reference docs require explicit judge metric tracking and discourage fire-and-forgetrun_judgeusage.Reviewed by Cursor Bugbot for commit f4f7015. Bugbot is set up for automated code reviews on this repo. Configure here.