Skip to content

feat: Add ManagedGraphResult, GraphMetricSummary, and AgentGraphRunnerResult types#151

Merged
jsonbailey merged 4 commits intomainfrom
jb/aic-2388/managed-graph-result
May 1, 2026
Merged

feat: Add ManagedGraphResult, GraphMetricSummary, and AgentGraphRunnerResult types#151
jsonbailey merged 4 commits intomainfrom
jb/aic-2388/managed-graph-result

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

@jsonbailey jsonbailey commented Apr 28, 2026

Summary

Adds the managed-layer return type and metric summary for agent graph execution, mirroring the per-config types introduced in PR 8.

  • GraphMetrics — runner-layer metrics (success, path, duration_ms, usage, node_metrics).
  • GraphMetricSummary — managed-layer summary, analogous to LDAIMetricSummary (adds resumption_token).
  • ManagedGraphResult — return type of ManagedAgentGraph.run() (content, metrics, raw, evaluations task).
  • AgentGraphRunnerResult — pure runner-layer return type (no evaluations field).
  • ManagedAgentGraph.run() now returns ManagedGraphResult and builds a GraphMetricSummary from the underlying runner's LDAIMetrics (path/node_metrics will be populated once graph runners migrate in PR 11).

Stack

PR 7 → PR 8 → PR 8-openai → PR 8-langchain → PR 9 (this) → PR 10 → PR 11 → PR 11-openai → PR 11-langchain → PR 12

Test plan

  • make test — 261 tests pass (server-ai 140, langchain 81, openai 40)
  • make lint — mypy clean

🤖 Generated with Claude Code


Note

Medium Risk
Introduces new public result/metrics types and changes ManagedAgentGraph.run() to return ManagedGraphResult (breaking callers expecting AgentGraphResult.output). Risk is mainly API/typing compatibility and downstream integrations relying on the old return shape.

Overview
Adds new agent-graph result/metrics dataclasses (GraphMetrics, GraphMetricSummary, ManagedGraphResult, AgentGraphRunnerResult) and exports them from ldai and ldai.providers.

Updates ManagedAgentGraph.run() to return a managed-layer ManagedGraphResult (with content + GraphMetricSummary) by wrapping the underlying runner’s AgentGraphResult, and adjusts tests to assert the new return type/field names.

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

@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from 37bad31 to b708885 Compare April 29, 2026 13:14
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from d847d83 to 9c9e802 Compare April 29, 2026 13:15
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from b708885 to c553fbd Compare April 29, 2026 13:19
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from 9c9e802 to 5fb879e Compare April 29, 2026 13:19
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from c553fbd to 5df809b Compare April 29, 2026 13:22
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from 5fb879e to 4319954 Compare April 29, 2026 13:22
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from 5df809b to c6e35a4 Compare April 29, 2026 13:48
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from 4319954 to ba64a62 Compare April 29, 2026 13:50
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from c6e35a4 to 08dfcb7 Compare April 29, 2026 13:56
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from ba64a62 to 49e95a3 Compare April 29, 2026 13:56
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from 08dfcb7 to ca37e74 Compare April 29, 2026 14:38
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from 49e95a3 to 80d4e11 Compare April 29, 2026 14:38
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from ca37e74 to 9c0003c Compare April 29, 2026 16:31
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from 80d4e11 to 05e1f4c Compare April 29, 2026 16:33
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch 9 times, most recently from 069c0ee to 1c0255f Compare April 29, 2026 21:56
Comment thread packages/sdk/server-ai/src/ldai/managed_agent_graph.py Outdated
content=result.output,
metrics=summary,
raw=result.raw,
evaluations=None,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This will be added in a follow up PR #153

@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from 1c0255f to 0355872 Compare April 30, 2026 14:01
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from 05e1f4c to 0a1ee15 Compare April 30, 2026 14:02
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from 0355872 to 796bda5 Compare April 30, 2026 14:21
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from 0a1ee15 to 72f5a37 Compare April 30, 2026 14:22
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from 796bda5 to a2db8cb Compare April 30, 2026 14:44
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from 72f5a37 to 8e60f79 Compare April 30, 2026 14:44
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch 3 times, most recently from 34598f5 to 36cd239 Compare May 1, 2026 17:28
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from 8e60f79 to 1b47300 Compare May 1, 2026 17:52
@jsonbailey
Copy link
Copy Markdown
Contributor Author

@cursor review

@jsonbailey jsonbailey marked this pull request as ready for review May 1, 2026 18:04
@jsonbailey jsonbailey requested a review from a team as a code owner May 1, 2026 18:04
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from 1b47300 to 3928030 Compare May 1, 2026 18:05
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1b47300. Configure here.

Comment thread packages/sdk/server-ai/src/ldai/managed_agent_graph.py Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3928030. Configure here.

Comment thread packages/sdk/server-ai/src/ldai/managed_agent_graph.py Outdated
@jsonbailey jsonbailey force-pushed the jb/aic-2388/langchain-runner-protocol branch from 7aae3e2 to 1e61d42 Compare May 1, 2026 21:28
Base automatically changed from jb/aic-2388/langchain-runner-protocol to main May 1, 2026 21:34
jsonbailey and others added 3 commits May 1, 2026 16:36
…rResult types

- Add GraphMetrics dataclass (runner-layer return type for graph runs)
- Add GraphMetricSummary dataclass (managed-layer metrics, analogous to
  LDAIMetricSummary for single-model invocations)
- Add ManagedGraphResult dataclass (managed-layer return type from ManagedAgentGraph)
- Add AgentGraphRunnerResult dataclass (future runner return type, no evaluations field)
- ManagedAgentGraph.run() now returns ManagedGraphResult with GraphMetricSummary
  built from the runner's AgentGraphResult metrics
- Export all new types from ldai package

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ent_graph

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jsonbailey jsonbailey force-pushed the jb/aic-2388/managed-graph-result branch from f9e947b to 75172d8 Compare May 1, 2026 21:37
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@jsonbailey jsonbailey merged commit 301e24c into main May 1, 2026
45 checks passed
@jsonbailey jsonbailey deleted the jb/aic-2388/managed-graph-result branch May 1, 2026 22:07
@github-actions github-actions Bot mentioned this pull request May 1, 2026
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.

2 participants