Problem Statement
Currently, when structured_output_model is enabled in Strands agents, the model is forced to always generate structured responses for every interaction, including simple conversational inputs such as:
"hi"
"hello"
"good morning"
"how are you"
This creates a poor conversational UX because small-talk responses are unnecessarily wrapped into structured JSON outputs.
Example:
Instead of:
Hello! How can I help you today?
the agent is forced to generate:
{
"type": "smalltalk",
"message": "Hello! How can I help you today?"
}
In real-world agentic applications, structured outputs are typically needed only for task-oriented requests such as:
extraction
workflows
API calls
automation
database operations
forms
business actions
but not for casual conversation.
The current SDK behavior applies structured_output_model globally for the entire invocation.
There is no official way to:
- dynamically disable structured output
- allow raw/plain-text responses for conversational queries
- conditionally switch between structured and unstructured responses
- support hybrid conversational + workflow agents cleanly
Proposed Solution
I also explored using:
Union[StructuredModel, SmallTalkModel]
and discriminated unions as a workaround.
However, the current implementation/tool schema conversion appears to flatten or degrade complex union schemas, leading to validation/tool-calling failures.
This suggests that advanced schema composition (Union, oneOf, polymorphic schemas) may not yet be fully supported in the structured output pipeline.
Use Case
Why This Matters
This feature is important for production-grade conversational agents because most real-world agents require:
natural conversation UX
workflow automation
structured extraction
tool invocation
mixed conversational behavior
within the same agent.
Currently developers must manually implement routing layers outside the SDK to achieve this cleanly.
Native support would significantly improve developer experience and make hybrid conversational/workflow agents easier to build using Strands.
Alternatives Solutions
Option 1 — structured_output_mode
Agent(
structured_output_model=MySchema,
structured_output_mode="auto"
)
Behavior:
task-oriented queries → structured output
casual/small-talk queries → plain text output
Option 2 — Native Hybrid Response Support
Allow:
Union[BaseModel, str]
or equivalent hybrid response handling officially.
Additional Context
No response
Problem Statement
Currently, when
structured_output_modelis enabled in Strands agents, the model is forced to always generate structured responses for every interaction, including simple conversational inputs such as:This creates a poor conversational UX because small-talk responses are unnecessarily wrapped into structured JSON outputs.
Example:
Instead of:
Hello! How can I help you today?the agent is forced to generate:
In real-world agentic applications, structured outputs are typically needed only for task-oriented requests such as:
but not for casual conversation.
The current SDK behavior applies structured_output_model globally for the entire invocation.
There is no official way to:
Proposed Solution
I also explored using:
Union[StructuredModel, SmallTalkModel]and discriminated unions as a workaround.
However, the current implementation/tool schema conversion appears to flatten or degrade complex union schemas, leading to validation/tool-calling failures.
This suggests that advanced schema composition (Union, oneOf, polymorphic schemas) may not yet be fully supported in the structured output pipeline.
Use Case
Why This Matters
This feature is important for production-grade conversational agents because most real-world agents require:
within the same agent.
Currently developers must manually implement routing layers outside the SDK to achieve this cleanly.
Native support would significantly improve developer experience and make hybrid conversational/workflow agents easier to build using Strands.
Alternatives Solutions
Option 1 — structured_output_mode
Behavior:
task-oriented queries → structured output
casual/small-talk queries → plain text output
Option 2 — Native Hybrid Response Support
Allow:
Union[BaseModel, str]or equivalent hybrid response handling officially.
Additional Context
No response