feat: Add ManagedAgentGraph support (PR-6)#111
feat: Add ManagedAgentGraph support (PR-6)#111jsonbailey wants to merge 2 commits intojb/aic-1664/graph-tracking-improvementsfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
|
|
||
| runner = await RunnerFactory.create_agent_graph( | ||
| graph, tools or {}, default_ai_provider | ||
| ) |
There was a problem hiding this comment.
Awaiting synchronous RunnerFactory.create_agent_graph causes TypeError
High Severity
RunnerFactory.create_agent_graph() is a synchronous @staticmethod that returns Optional[Any] directly, not a coroutine. Using await on its return value will raise a TypeError at runtime (e.g. "object 'OpenAIAgentGraphRunner' can't be used in 'await' expression"). The tests pass only because they patch this method with AsyncMock, masking the real failure.
packages/ai-providers/server-ai-openai/src/ldai_openai/openai_agent_graph_runner.py
Outdated
Show resolved
Hide resolved
| instructions=f'[RECOMMENDED_PROMPT_PREFIX] {node_config.instructions or ""}', | ||
| handoffs=list(agent_handoffs), | ||
| tools=list(agent_tools), | ||
| ) |
There was a problem hiding this comment.
OpenAI Agent created without configured model name
High Severity
The Agent constructor is called without the model parameter, so every agent defaults to the OpenAI SDK's built-in default model instead of using the model configured in LaunchDarkly (e.g., node_config.model.name). The model config is validated to exist (line 119) and used for tool definitions (line 122), but its name is never forwarded to the Agent. The LangGraph sibling runner correctly passes node_config.model.name to init_chat_model.
…aphRunner Implements PR 5 — ManagedAgentGraph + create_agent_graph(): ldai: - managed_agent_graph.py: ManagedAgentGraph wrapper holding AgentGraphRunner + AIGraphTracker; exposes run(), get_agent_graph_runner(), get_tracker() - LDAIClient.create_agent_graph(key, context, tools): resolves graph via agent_graph(), delegates to RunnerFactory, returns ManagedAgentGraph - Exports ManagedAgentGraph from top-level ldai package ldai_openai: - OpenAIAgentGraphRunner(AgentGraphRunner): builds agents via reverse_traverse using the openai-agents SDK; auto-tracks path, tool calls, handoffs, latency, invocation success/failure - OpenAIRunnerFactory.create_agent_graph(graph_def, tools) -> OpenAIAgentGraphRunner ldai_langchain: - LangGraphAgentGraphRunner(AgentGraphRunner): builds a LangGraph StateGraph via traverse(); auto-tracks latency and invocation success/failure - LangChainRunnerFactory.create_agent_graph(graph_def, tools) -> LangGraphAgentGraphRunner Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…n rollup Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
226dfdf to
e57a147
Compare


feat: Add OpenAIAgentGraphRunner support
feat: Add LangGraphAgentGraphRunner support
Note
Medium Risk
Adds a new agent-graph execution surface across the SDK and introduces new provider runners while also changing
LDAIConfigTracker.track_metrics_offrom async to sync (addingtrack_metrics_of_async), which can break integrations and subtly affect tracking behavior.Overview
Adds managed agent graph execution via new
ManagedAgentGraphandLDAIClient.create_agent_graph(), which resolves anAgentGraphDefinition, creates a provider-specific runner, and exposesrun().Introduces provider implementations for graph execution:
OpenAIAgentGraphRunner(OpenAI Agents SDK) andLangGraphAgentGraphRunner(LangGraph), pluscreate_agent_graph()factory hooks and exports for both providers; runners record graph path/latency/success, node-level metrics, and tool calls.Updates tracking APIs to support graphs by adding optional
graph_keymetadata to config-level events, adding tool-call tracking onLDAIConfigTracker, makingAIGraphTracker.track_total_tokenstolerate missing usage, and splitting metric tracking into synctrack_metrics_of()and asynctrack_metrics_of_async(); docs/tests are updated accordingly.Written by Cursor Bugbot for commit e57a147. This will update automatically on new commits. Configure here.