Skip to content

fix: Modernize AI Configs agent skills to current 0.20 SDK#61

Open
jsonbailey wants to merge 8 commits into
mainfrom
jb/aic-2383/modernize-aiconfigs-skills
Open

fix: Modernize AI Configs agent skills to current 0.20 SDK#61
jsonbailey wants to merge 8 commits into
mainfrom
jb/aic-2383/modernize-aiconfigs-skills

Conversation

@jsonbailey
Copy link
Copy Markdown

@jsonbailey jsonbailey commented May 14, 2026

Summary

  • Replace removed Node *Provider class namespaces with bare module exports + *RunnerFactory
  • Replace removed LDAIClient method aliases and managed-chat API (initChat / createChat / TrackedChat) with current names (createModel / ManagedModel.run)
  • Replace removed tracker convenience helpers (trackOpenAIMetrics, trackBedrockConverseMetrics, trackVercelAISDKGenerateTextMetrics) 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
  • Replace Python OpenAIProvider.create() + provider.invoke_model() with ai_client.create_model() + model.run() (Tier 1) and bare get_ai_metrics_from_response import (Tier 2) — Python OpenAIProvider class does not exist in ldai_openai
  • Swap Python track_metrics_of / track_metrics_of_async arg order to (extractor, func) per Python 0.19 BREAKING

These 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) and launchdarkly-server-sdk-ai@0.19.x+ (Python).

Refs AIC-2383. Part of the AI Configs docs/example modernization sweep.

Test plan

  • Final grep sweep returns zero hits for each removed identifier (full list in commit messages)
  • Spot-render a few SKILL.md files to confirm markdown integrity
  • Run one of the migrate skills end-to-end to confirm coding agents produce compileable Node + Python code

🤖 Generated with Claude Code

jsonbailey and others added 3 commits May 14, 2026 09:48
- 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>
@jsonbailey jsonbailey force-pushed the jb/aic-2383/modernize-aiconfigs-skills branch 2 times, most recently from d8faac8 to ac917b5 Compare May 14, 2026 16:51
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>
@jsonbailey jsonbailey force-pushed the jb/aic-2383/modernize-aiconfigs-skills branch from ac917b5 to 2da2496 Compare May 14, 2026 16:53
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>
@jsonbailey jsonbailey marked this pull request as ready for review May 14, 2026 17:04
@jsonbailey jsonbailey requested a review from a team as a code owner May 14, 2026 17:04
@jsonbailey jsonbailey requested a review from sattensil May 14, 2026 21:01
Comment thread skills/ai-configs/aiconfig-ai-metrics/references/langchain-tracking.md Outdated
Comment thread skills/ai-configs/aiconfig-ai-metrics/references/openai-tracking.md Outdated
Comment thread skills/ai-configs/aiconfig-ai-metrics/references/openai-tracking.md Outdated
Comment thread skills/ai-configs/aiconfig-ai-metrics/references/openai-tracking.md Outdated
Comment thread skills/ai-configs/aiconfig-ai-metrics/SKILL.md Outdated
Comment thread skills/ai-configs/aiconfig-migrate/references/sdk-ai-tracker-patterns.md Outdated
Copy link
Copy Markdown

@LindseyB LindseyB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking good, but I've commented a couple spots where I think the modernization pieces were missing. Definitely try out those changes and give it a test. 😄

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>
Copy link
Copy Markdown

@LindseyB LindseyB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for fixing that so fast.

jsonbailey and others added 2 commits May 15, 2026 14:10
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants