Skip to content

fix: Use summary.tokens instead of summary.usage in examples#32

Merged
jsonbailey merged 1 commit into
mainfrom
jb/aic-2267/fix-graph-example-tokens
May 19, 2026
Merged

fix: Use summary.tokens instead of summary.usage in examples#32
jsonbailey merged 1 commit into
mainfrom
jb/aic-2267/fix-graph-example-tokens

Conversation

@jsonbailey
Copy link
Copy Markdown
Contributor

Summary

  • The agent-graph example reads summary.usage / node_summary.usage, but the SDK exposes these as summary.tokens / node_summary.tokens. PR fix: Use tokens= instead of usage= on LDAIMetrics constructors #30 fixed LDAIMetrics constructors but missed these read sites. Without this fix the example crashes with AttributeError when it reaches the metrics print block.
  • The same stale .usage read appears on metric-summary objects across the other examples (create_agent, langgraph react + multi-agent, langchain, openai, bedrock, gemini); all are updated to .tokens here so the whole example suite stays consistent.

Test plan

  • Run poetry run agent-graph against a project with a configured agent graph; verify token counts print without AttributeError.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jsonbailey jsonbailey requested a review from a team as a code owner May 18, 2026 20:55
@jsonbailey jsonbailey merged commit 61669c7 into main May 19, 2026
4 checks passed
@jsonbailey jsonbailey deleted the jb/aic-2267/fix-graph-example-tokens branch May 19, 2026 15:34
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