fix: Modernize AI Configs agent skills to current 0.20 SDK#61
Open
jsonbailey wants to merge 8 commits into
Open
fix: Modernize AI Configs agent skills to current 0.20 SDK#61jsonbailey wants to merge 8 commits into
jsonbailey wants to merge 8 commits into
Conversation
- Replace removed Node *Provider class namespaces with bare module exports + *RunnerFactory - Replace removed LDAIClient method aliases and managed-chat API with current names - Replace removed tracker convenience helpers with trackMetricsOf + bare extractors - Drop unnecessary createTracker!() non-null assertions - Switch LDAIMetrics literal usage: -> tokens: (0.20 rename) - Rename LDAIDefaults -> LDAICompletionConfigDefault and LDAIAgentDefault -> LDAIAgentConfigDefault - Bump compatibility statement to >=0.20.0 - Generalize provider-tracking prose to use trackMetricsOf universally Refs AIC-2383 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…lpers - openai-tracking.md, aiconfig-migrate/SKILL.md, sdk-ai-tracker-patterns.md - Python OpenAIProvider class does not exist in ldai_openai; replace OpenAIProvider.create + provider.invoke_model with managed aiClient.create_model() + model.run() (Tier 1) and bare get_ai_metrics_from_response import (Tier 2) - Swap track_metrics_of arg order to (extractor, func) per Python 0.19 across all Python examples (anthropic, bedrock, gemini, langchain, openai, strands, aiconfig-tools, aiconfig-migrate, sdk-ai-tracker-patterns) Refs AIC-2383 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…i>=0.20.0 The skill code now uses 0.20 APIs (tokens= field, removed providers, etc.). Match the Python compat declaration to the Node side and the actual SDK floor the snippets require. Refs AIC-2383 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
d8faac8 to
ac917b5
Compare
The skill code targets Python AI SDK 0.20+ (tokens= field, removed provider classes, track_judge_result, etc.) but five "compatibility" / "verified against" / "current releases" statements still said v0.18.0 for Python. Update to v0.20.0 to match what the snippets actually require. Refs AIC-2383 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ac917b5 to
2da2496
Compare
Skills that bake in specific SDK versions ("verified against v0.20.0",
"renamed from track_latency in v0.18.0", "added in v0.17.0") go stale
the moment the SDK ships a new release. Point at the CHANGELOG instead
and describe what the API IS now.
- aiconfig-migrate/SKILL.md: Prerequisites now instructs the agent to
fetch the latest CHANGELOG before applying any pattern below.
- sdk-ai-tracker-patterns.md: drop "verified against v0.20.0" pin and
add CHANGELOG links at the top; reword the L8 SDK-version gotcha to
point at CHANGELOGs for the per-method version-landed-in info.
- agent-graph-reference.md: strip "renamed in v0.18.0" / "added in v0.17.0"
historical annotations; describe current behavior only. Add CHANGELOG
links to the Resources section.
Refs AIC-2383
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
andrewklatzke
approved these changes
May 14, 2026
LindseyB
reviewed
May 15, 2026
LindseyB
reviewed
May 15, 2026
LindseyB
reviewed
May 15, 2026
LindseyB
reviewed
May 15, 2026
LindseyB
reviewed
May 15, 2026
LindseyB
reviewed
May 15, 2026
LindseyB
reviewed
May 15, 2026
Two patterns Lindsey caught on the open PR review (and which the multi- line / pattern-list gap in our validation greps let through): - `LDAIMetrics(success=True, usage=TokenUsage(...))` Python multi-line constructor → `tokens=TokenUsage(...)`. The dataclass field is `tokens`; constructor with `usage=` raises TypeError on 0.20+. Fixed in 8 spots across anthropic-, bedrock-, gemini-, langchain-, openai-, strands-tracking.md and sdk-ai-tracker-patterns.md. - `ManagedModel.invoke()` → `model.run()` and `response.message.content` → `response.content` (ManagedResult is flat). Renamed in SDK 0.19. Fixed in SKILL.md Tier 1 table row (Python side), openai-tracking.md Tier 1 example, and sdk-ai-tracker-patterns.md Tier 1 mention. - `ai_client.create_chat(...)` + `chat.invoke(...)` removed at 0.20. Replaced with `create_model(...)` + `model.run(...)` in aiconfig-online-evals/SKILL.md. Refs AIC-2383 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
LindseyB
approved these changes
May 15, 2026
LindseyB
left a comment
There was a problem hiding this comment.
Looks good, thanks for fixing that so fast.
The Python `hello-python-ai/examples/` directory was emptied during the AIC-1934 reorg (examples moved under `features/` and `getting_started/`); the Node `js-core/packages/sdk/server-ai/examples/judge-evaluation/` dir was removed during the EXAM-SDK-example restructure in js-core #1379 (examples split into `features/` and `getting-started/`). Update the broken links in aiconfig-online-evals/SKILL.md: - direct_judge_example.py → features/create_judge/create_judge_example.py - chat_judge_example.py → features/create_model/create_model_example.py (chat-judge demo is now the managed-model example; attached judges fire automatically during `run`) - js-core judge-evaluation → split into features/create-judge (direct) and features/create-model (auto) All four target URLs verified via gh api. Refs AIC-2383 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three correctness fixes to the AI Configs skills, surfaced by sub-agent test runs against the modernized skill content: - Drop `await` from `ai_client.create_judge(...)` in three places (aiconfig-online-evals/SKILL.md, aiconfig-migrate/SKILL.md, and aiconfig-migrate/references/sdk-ai-tracker-patterns.md). The SDK's `create_judge` is synchronous and returns `Optional[Judge]`; awaiting it raises TypeError. `Judge.evaluate(...)` is still correctly awaited. - In the aiconfig-online-evals Direct Judge example, swap the default passed to `create_judge` from `AICompletionConfigDefault(enabled=False)` to `AIJudgeConfigDefault(enabled=False)`. The `default` parameter is typed `Optional[AIJudgeConfigDefault]` and the rule is already documented in sdk-ai-tracker-patterns.md — the example just wasn't following it. - Add an "On the current SDK API?" checklist item to step 1 of aiconfig-ai-metrics so that when the call site uses pre-0.20 `aiclient.config(...)` / `AIConfig(...)`, the agent migrates to `completion_config()`/`agent_config()` and `AICompletionConfigDefault`/ `AIAgentConfigDefault` before adding tracking, instead of stacking modern tracking on top of stale call shapes. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
*Providerclass namespaces with bare module exports +*RunnerFactoryLDAIClientmethod aliases and managed-chat API (initChat/createChat/TrackedChat) with current names (createModel/ManagedModel.run)trackOpenAIMetrics,trackBedrockConverseMetrics,trackVercelAISDKGenerateTextMetrics) withtrackMetricsOf+ bare extractorscreateTracker!()non-null assertionsLDAIMetricsliteralusage:->tokens:(0.20 rename)LDAIDefaults->LDAICompletionConfigDefaultandLDAIAgentDefault->LDAIAgentConfigDefault>=0.20.0trackMetricsOfuniversallyOpenAIProvider.create()+provider.invoke_model()withai_client.create_model()+model.run()(Tier 1) and bareget_ai_metrics_from_responseimport (Tier 2) — PythonOpenAIProviderclass does not exist inldai_openaitrack_metrics_of/track_metrics_of_asyncarg order to(extractor, func)per Python 0.19 BREAKINGThese skills shape what coding agents emit when users invoke them — every stale pattern propagates to user code. Net effect: agents following these skills produce code that typechecks and runs against current
@launchdarkly/server-sdk-ai@0.20.x(Node) andlaunchdarkly-server-sdk-ai@0.19.x+(Python).Refs AIC-2383. Part of the AI Configs docs/example modernization sweep.
Test plan
🤖 Generated with Claude Code