Skip to content

fix(built-in-metrics): roll forward to the new AI SDK - #219

Open
sattensil wants to merge 5 commits into
mainfrom
scarlett/sdk-roll-forward/built-in-metrics
Open

sattensil wants to merge 5 commits into
mainfrom
scarlett/sdk-roll-forward/built-in-metrics

Conversation

@sattensil

@sattensil sattensil commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Rewrite around a ladder: convenience function → config() + handler package → custom handler → manual track() for feedback.
  • Document what the SDK records (no TTFT), the legacy-to-current mapping, and per-provider references for OpenAI/Azure, Anthropic, Bedrock, Gemini, LangChain/LangGraph, Strands, and streaming.
  • Custom handlers render {{name}} with parse_template and drop tools from model.parameters; Strands drops temperature/top_p for anthropic 2.x.
  • Fix metrics-api.md to use milliseconds.

Jira: DEVREL-1645

Testing

  • Not applicable
  • Manual (describe below)

Ran each reference's code in the cookbook notebooks (OpenAI, Anthropic, Bedrock, Gemini, LangChain, LangGraph, Strands, streaming, feedback, metrics API). Verified feedback events through the metrics API.

Notes

  • Targets launchdarkly-ai-server 0.3.0 (Python) and @launchdarkly/ai-node 0.3.0 (Node.js).
  • Part of a set of six roll-forward PRs (migrate, built-in-metrics, projects, tools, online-evals, custom-metrics). Each regenerates skills.json, so later merges may need python3 scripts/generate_catalog.py re-run.
  • The matching notebook in launchdarkly-labs/agentcontrol-cookbooks mirrors this skill's code; that update lands separately.

Note

Overview
Rolls the built-in-metrics skill to v2 for launchdarkly-ai-server / @launchdarkly/ai-node 0.3.0+, replacing the old tracker/trackMetricsOf/ManagedModel guidance with a four-step ladder: convenience functions → config() + handler packages → custom handlers → manual track() for feedback only.

The main skill now states that metrics are automatic when calls go through invoke() / stream(), documents recorded $ld:ai:* events (including tool calls), clarifies that TTFT is not emitted, adds a legacy-to-current mapping table, and updates guardrails (shutdown(), disabled-config behavior, no double-tracking).

Per-provider reference docs (OpenAI, Anthropic, Bedrock, Gemini, LangChain/LangGraph, Strands, streaming) are rewritten around handler package names, create_handler patterns, parse_template, and dropping tools from model.parameters. Streaming drops manual TTFT wiring in favor of stream().

skills.json picks up the new description, compatibility line, and 2.0.0-experimental version. metrics-api.md fixes query from/to to Unix milliseconds and notes TTFT stays zero on the new SDKs.

Reviewed by Cursor Bugbot for commit b072236. Bugbot is set up for automated code reviews on this repo. Configure here.

Replace the tracker ladder with the current one: convenience functions, config() with handler packages, custom handlers, and manual track() for feedback. Rewrite each provider reference around handlers, document what the SDK records and what it doesn't (time to first token, feedback), add a legacy-to-current mapping, and fix the metrics API timestamps, which are milliseconds.
…lers

Custom handlers now fill {{name}} placeholders with parse_template and drop the tools key from model.parameters before calling the provider. Note that the Python OpenAI handler doesn't forward parameters, that inspect_config is async, and that the to_lang_graph runner is called with invoke().
…icModel

anthropic 2.x removed both arguments from messages.create, so forwarding them from the variation raises TypeError.
@github-actions

Copy link
Copy Markdown

Skill eval results

Skill Before After Δ
agentcontrol/configs-create 100/100 (4/4) 100/100 (4/4) no change
agentcontrol/configs-update 80/100 (4/5) 80/100 (4/5) no change
agentcontrol/configs-variations 80/100 (4/5) 80/100 (4/5) no change
agentcontrol/tools 75/100 (3/4) 75/100 (3/4) no change
feature-flags/flag-and-release-change - 100/100 (4/4) new
feature-flags/flag-release - 100/100 (5/5) new
feature-flags/launchdarkly-flag-command - 100/100 (3/3) new
feature-flags/launchdarkly-flag-create 100/100 (3/3) 100/100 (4/4) no change
feature-flags/launchdarkly-flag-drift - 100/100 (4/4) new
feature-flags/should-flag-change - 100/100 (17/17) new
onboarding - 75/100 (3/4) new

Only suites whose source actually changed since their last recorded score were re-run. Soft-failing while we stabilise the baseline.

@sattensil
sattensil requested a review from jeffdupont October 23, 2026 20:17
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.

1 participant