Skip to content

fix: Modernize devrel agents tutorial to current Python AI SDK 0.20#24

Open
jsonbailey wants to merge 1 commit into
mainfrom
jb/aic-2383/modernize-to-current-ai-sdk
Open

fix: Modernize devrel agents tutorial to current Python AI SDK 0.20#24
jsonbailey wants to merge 1 commit into
mainfrom
jb/aic-2383/modernize-to-current-ai-sdk

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

Summary

The tutorial used a chain of pre-0.11 + pre-0.18 APIs: removed LDAIAgentConfig/LDAIAgentDefaults types, removed ai_client.agent(...) method, removed config.tracker property, and track_latency_ms (which never existed). Modernize to current Python AI SDK 0.20.x.

  • Type names: LDAIAgentConfigAIAgentConfigRequest; LDAIAgentDefaultsAIAgentConfigDefault
  • API renames: ai_client.agent(...)ai_client.agent_config(...); default_value=default= kwarg
  • Tracker factory: hoist tracker = config.create_tracker() everywhere config.tracker was accessed
  • Method fix: track_latency_mstrack_duration (the hasattr guard meant it silently no-op'd before)
  • Imports: canonicalize from ldai.clientfrom ldai
  • Pin bump: launchdarkly-server-sdk-ai>=0.1.0>=0.20.0

Refs AIC-2383. Part of the AI Configs docs/example modernization sweep tracked in python-agent-work/all-docs-review.md.

Test plan

  • python -m py_compile on all modified files
  • pip install -e . (or equivalent) resolves cleanly against current SDK
  • Run the multi-agent demo end-to-end against LAUNCHDARKLY_SDK_KEY
  • Final grep sweep returns zero hits for the removed-API patterns

🤖 Generated with Claude Code

- config_manager.py: replace removed LDAIAgentConfig/LDAIAgentDefaults with AIAgentConfigRequest/AIAgentConfigDefault; default_value= -> default= kwarg rename; replace removed .agent() method with agent_config(...)
- Hoist tracker = config.create_tracker() (replaces removed config.tracker) across config_manager, supervisor_agent, security_agent, ld_agent_helpers, agent_service, api/main
- Replace non-existent track_latency_ms with track_duration in ld_agent_helpers
- Canonicalize from ldai.client -> from ldai imports
- Bump pyproject.toml pin to launchdarkly-server-sdk-ai>=0.20.0

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 21:15
@jsonbailey jsonbailey requested a review from sattensil May 14, 2026 21:15
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