Skip to content

Conversation

jwalaQ
Copy link

@jwalaQ jwalaQ commented Sep 20, 2025

Description

Added usage guidance on a commonly observed misunderstanding about "structured_output". Customers usually expect to be able to use "structured_output" to continue conversations like regular agent prompts, however tool use apart from the Pydantic model tool cause errors

Type of Change

  • New content addition

Motivation and Context

Primarily provides more clarity on the intended usage as called out here -
309, 872

Improves customer expectation for short-term, while changes like strands-agents/sdk-python#891 can potentially solve for long term.

Areas Affected

Description of structured_output

Screenshots

image

Checklist

  • I have read the CONTRIBUTING document
  • My changes follow the project's documentation style
  • I have tested the documentation locally using mkdocs serve
  • Links in the documentation are valid and working
  • Images/diagrams are properly sized and formatted
  • All new and existing tests pass

Additional Notes

None

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@yonib05 yonib05 requested a review from afarntrog September 20, 2025 15:16
Then use the `Agent.structured_output()` method as shown in the following sections.

> #### Note on Usage
> Using `structured_ouput` creates a tool with the same name as the Pydantic model you have defined, say - "SomePydanticModel".
Copy link
Member

Choose a reason for hiding this comment

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

This is only true for some providers - others use the model's API for structured output.

For the providers that do use a tool - the only tool available is the PydanticModel tool and now it's forced used so the model doesn't even have a choice.

Copy link
Author

Choose a reason for hiding this comment

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

Updated according to comment.

@jwalaQ jwalaQ requested a review from zastrowm September 23, 2025 03:51
@jwalaQ
Copy link
Author

jwalaQ commented Oct 1, 2025

@zastrowm could you take another look?

@jwalaQ
Copy link
Author

jwalaQ commented Oct 1, 2025

We need @afarntrog 's review to close this as well, I believe.

Then use the `Agent.structured_output()` method:
Then use the `Agent.structured_output()` method as shown in the following sections.

> #### Note on Usage
Copy link
Contributor

Choose a reason for hiding this comment

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

consider using the following format for the note instead:

!!! note "Note on Usage"
    text here...

This will render it with a note background and icon like we elsewhere. For example: https://squidfunk.github.io/mkdocs-material/reference/admonitions/#changing-the-title

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.

3 participants