Skip to content

Conversation

@strands-agent
Copy link
Contributor

@strands-agent strands-agent commented Jan 13, 2026

Superseded

This PR has been superseded by PR #1472 which implements Option 1 (modifying __str__ directly) as requested by @afarntrog.

Closing this PR in favor of the cleaner approach.

When a graph node returns both text and structured_output in an AgentResult,
only the text was being propagated to the next node. The structured_output
was lost because the graph used str(result) which ignores structured_output
when text is present.

This fix adds a to_node_output() method to AgentResult that includes both
text content AND structured_output when present, ensuring no data is lost
during graph transitions.

Changes:
- Add AgentResult.to_node_output() method for graph transitions
- Update graph.py to use to_node_output() instead of str()
- Add 5 comprehensive unit tests for the new method

Fixes strands-agents#1461
@strands-agent
Copy link
Contributor Author

Closing as duplicate - #1463 has more comprehensive test coverage (9 tests vs 5 tests). Both PRs address #1461 with similar approaches.

🦆


🤖 This is an experimental AI agent response from the Strands team, powered by Strands Agents. We're exploring how AI agents can help with community support and development. Your feedback helps us improve! If you'd prefer human assistance, please let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant