Skip to content

Conversation

Copy link

Copilot AI commented Dec 4, 2025

Description

When using structured_output_model in Graph agents, output from dependency nodes was not propagated to subsequent nodes. The _build_node_input method was calling str(result) which only extracts message text content, ignoring the structured_output field entirely.

Changes:

  • Modified _build_node_input to prefer structured_output.model_dump_json() when available
  • Falls back to str(result) for backward compatibility

Before: Second agent receives empty input

"  - Agent: "

After: Second agent receives structured JSON

"  - Agent: {"foo":"hello","bar":"world"}"

Related Issues

strands-agents#1118

Documentation PR

N/A

Type of Change

Bug fix

Testing

  • Added test_graph_structured_output_propagation - verifies structured output is propagated as JSON

  • Added test_graph_structured_output_fallback_to_text - verifies backward compatibility when no structured output

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published
Original prompt

Come up with a fix for this issue described here: strands-agents#1118


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

When using structured_output_model, the _build_node_input method now
prefers the structured_output's JSON representation over str(result).
This fixes issue strands-agents#1118 where structured output was not properly
propagated from dependency nodes to subsequent nodes in a Graph.

Co-authored-by: afarntrog <47332252+afarntrog@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix style compatibility issue in SDK Fix structured_output propagation in Graph nodes Dec 4, 2025
Copilot AI requested a review from afarntrog December 4, 2025 19:36
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