generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 447
Open
0 / 60 of 6 issues completedLabels
area-structured-outputRelated to the structured output apiRelated to the structured output apienhancementNew feature or requestNew feature or request
Description
Problem Statement
The existing Strucuted output feature in strands sdk has lead to user confusion. Users expect to get a similar behavior out of structured output as they get from invoking an agent. Structured output today does not operate agentically (no tool use), and provides poor ways to inspect metrics or streamed events.
Proposed Solution
from pydantic import BaseModel
from strands import Agent
class WeatherInCity(BaseModel):
city: str
weather: str
agent = Agent(tools=[http_request])
result = agent("Whats the weather in paris?", output_model=WeatherInCity)
# Contains the structured output of the model
result.structured_output
- Structured output result will be added to the agent messages as a tool result
- If the model does not use the
output_model
tool during execution, and instead returns a "stop_reason", an error will be raised - If the model tries to use the structured_output model, but fails for a validation exception, this is returned to the model to retry
Use Case
- Tools attached to an agent can be used while generating structured output
- Metrics are included when using structured output (as of now it does not show)
- Events from the LLM are accessible to the user during structured output streaming
Alternatives Solutions
- Extend the existing
agent.structured_output
function to exhibit this behavior
Additional Context
N/A
mirgj, clareliguori, lukehau and mbuotidem
Sub-issues
Metadata
Metadata
Assignees
Labels
area-structured-outputRelated to the structured output apiRelated to the structured output apienhancementNew feature or requestNew feature or request