[GH-ISSUE #1042] [langchain]: is direct schema passing for create_agent's response_format supported? #138

Open
opened 2026-02-17 17:19:15 -05:00 by yindo · 2 comments
Owner

Originally created by @lesong36 on GitHub (Oct 21, 2025).
Original GitHub issue: https://github.com/langchain-ai/docs/issues/1042

I've found conflicting information in the documentation regarding the correct way to use the response_format parameter in create_agent.

1. The "Structured output" Page (Suggests direct passing IS supported):

On this page: https://docs.langchain.com/oss/python/langchain/structured-output#response-format

The documentation states:

If the provider natively supports structured output for your model choice, it is functionally equivalent to write response_format=ProductReview instead of response_format=ToolStrategy(ProductReview). In either case, if structured output is not supported, the agent will fall back to a tool calling strategy.

This text, along with the code examples, implies that passing a schema type directly (e.g., response_format=MySchema) is a valid and supported method that automatically selects the best strategy.

2. The "Agents" Page (Suggests direct passing is NOT supported):

On this page: https://docs.langchain.com/oss/python/langchain/agents#providerstrategy

The documentation states:

As of langchain 1.0, simply passing a schema (e.g., response_format=ContactInfo) is no longer supported. You must explicitly use ToolStrategy or ProviderStrategy.

The Contradiction:

These two statements are in direct conflict. One says passing the schema directly is "functionally equivalent" and has an automatic fallback, while the other says it is "no longer supported" as of v1.0 and that an explicit ToolStrategy or ProviderStrategy must be used.

Question:

Could you please clarify which statement is true for the current version of LangChain (v1.0+)?

  • Is response_format=MySchema supported?
  • Or must we always use response_format=ToolStrategy(MySchema) or response_format=ProviderStrategy(MySchema)?

It would be very helpful to update the documentation to reflect the single, correct approach.

Thank you!

Originally created by @lesong36 on GitHub (Oct 21, 2025). Original GitHub issue: https://github.com/langchain-ai/docs/issues/1042 I've found conflicting information in the documentation regarding the correct way to use the `response_format` parameter in `create_agent`. **1. The "Structured output" Page (Suggests direct passing IS supported):** On this page: `https://docs.langchain.com/oss/python/langchain/structured-output#response-format` The documentation states: > If the provider natively supports structured output for your model choice, it is functionally equivalent to write `response_format=ProductReview` instead of `response_format=ToolStrategy(ProductReview)`. In either case, if structured output is not supported, the agent will fall back to a tool calling strategy. This text, along with the code examples, implies that passing a schema type directly (e.g., `response_format=MySchema`) is a valid and supported method that automatically selects the best strategy. **2. The "Agents" Page (Suggests direct passing is NOT supported):** On this page: `https://docs.langchain.com/oss/python/langchain/agents#providerstrategy` The documentation states: > As of `langchain 1.0`, simply passing a schema (e.g., `response_format=ContactInfo`) is no longer supported. You must explicitly use `ToolStrategy` or `ProviderStrategy`. **The Contradiction:** These two statements are in direct conflict. One says passing the schema directly is "functionally equivalent" and has an automatic fallback, while the other says it is "no longer supported" as of v1.0 and that an explicit `ToolStrategy` or `ProviderStrategy` *must* be used. **Question:** Could you please clarify which statement is true for the current version of LangChain (v1.0+)? * **Is `response_format=MySchema` supported?** * Or **must** we always use `response_format=ToolStrategy(MySchema)` or `response_format=ProviderStrategy(MySchema)`? It would be very helpful to update the documentation to reflect the single, correct approach. Thank you!
yindo added the external label 2026-02-17 17:19:15 -05:00
Author
Owner

@eyurtsev commented on GitHub (Oct 21, 2025):

response_format=MySchema is supported. It is converted into an AutoStrategy and will allow us to try and choose the best strategy based on the model that's used.

We'll try to update docs to reflect that. thank you for filing the issue

@eyurtsev commented on GitHub (Oct 21, 2025): `response_format=MySchema` is supported. It is converted into an AutoStrategy and will allow us to try and choose the best strategy based on the model that's used. We'll try to update docs to reflect that. thank you for filing the issue
Author
Owner

@ademicho123 commented on GitHub (Jan 5, 2026):

Hi, I want to work on this issue. Could a maintainer please assign it to me?

I will verify which documentation is correct by testing the actual behavior and update the incorrect page to ensure consistency

This should be ready in few days.

Thanks.

@ademicho123 commented on GitHub (Jan 5, 2026): Hi, I want to work on this issue. Could a maintainer please assign it to me? I will verify which documentation is correct by testing the actual behavior and update the incorrect page to ensure consistency This should be ready in few days. Thanks.
yindo changed title from [langchain]: is direct schema passing for `create_agent`'s `response_format` supported? to [GH-ISSUE #1042] [langchain]: is direct schema passing for `create_agent`'s `response_format` supported? 2026-06-05 17:25:17 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/docs#138