fix: Modernize agent-graphs to AI SDK 0.20+#27
Open
sattensil wants to merge 1 commit into
Open
Conversation
Brings tutorial/agent-graphs in line with the modernization that landed on main via #24 (devrel-agents-tutorial), plus the missing config_manager methods added on main in the offline-evals work that this branch never picked up. SDK migration: - pyproject.toml: launchdarkly-server-sdk-ai >=0.10.0 -> >=0.20.0; drop [tool.uv.sources] git override pinning to python-server-sdk-ai@main - config_manager.py: from ldai.client -> from ldai - Replace removed `config.tracker` attribute with `config.create_tracker()` across config_manager.py, generic_agent.py, ld_agent_helpers.py, agent_service.py, api/main.py - In generic_agent.py hoist `tracker = agent_config.create_tracker()` once so the try/except shares a single tracker Fix pre-existing import-time AttributeError on this branch: - agent_service.AgentService.__init__ calls `self.config_manager.clear_cache()` and `self.config_manager.get_agent_graph(...)` but neither existed on FixedConfigManager in this branch. Port both from main (clear_cache is a no-op; get_agent_graph wraps ai_client.agent_graph). Verified by importing config_manager, agents.ld_agent_helpers, agents.generic_agent, api.services.agent_service, and api.main in a fresh venv with launchdarkly-server-sdk-ai 1.0.1. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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
Brings
tutorial/agent-graphsin line with the SDK modernization that landed onmainvia #24, plus twoconfig_managermethods that were added tomainin the offline-evals work (2026-04-09) but never back-ported to this branch.SDK migration
pyproject.toml: bumplaunchdarkly-server-sdk-aipin>=0.10.0→>=0.20.0; drop the[tool.uv.sources]git override pointing atpython-server-sdk-ai@mainso we install the published package.config_manager.py: canonicalizefrom ldai.client→from ldai.config.trackerattribute withconfig.create_tracker()acrossconfig_manager.py,agents/generic_agent.py,agents/ld_agent_helpers.py,api/services/agent_service.py,api/main.py.generic_agent.py, hoisttracker = agent_config.create_tracker()once so the try/except shares a single tracker (avoids creating four trackers per call).Pre-existing branch bug, fixed
This branch was broken at import time before this PR:
AgentService.__init__callsself.config_manager.clear_cache()andagent_service.py:50callsself.config_manager.get_agent_graph(...), but neither was defined on this branch'sFixedConfigManager. Both methods were added onmain(commitdbdf4e9, "Add offline-evals tutorial companion") and never picked up here. Ported with no logic changes.Test plan
launchdarkly-server-sdk-ai>=0.20.0in a fresh venv (resolves to1.0.1).config_manager,agents.ld_agent_helpers,agents.generic_agent,api.services.agent_service,api.main— all succeed (previouslyapi.mainfailed withAttributeError: 'FixedConfigManager' object has no attribute 'clear_cache').🤖 Generated with Claude Code