generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 461
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Checks
- I have updated to the lastest minor and patch version of Strands
- I have checked the documentation and this is not expected behavior
- I have searched ./issues and there are no duplicates of my issue
Strands Version
1.14.0
Python Version
3.11.14
Operating System
macOS 15.7
Installation Method
pip
Steps to Reproduce
Error:
def some_function(self) -> TestOutputModel:
agent = Agent(structured_output_model=TestOutputModel)
agent_response = agent("This is a test")
return agent_response.structured_output # mypy fails due to error: Incompatible return value type (got "BaseModel | None", expected "TestOutputModel") [return-value]Expected Behavior
Workaround:
def some_function(self) -> TestOutputModel:
agent = Agent(structured_output_model=TestOutputModel)
agent_response = agent("This is a test")
return cast(TestOutputModel, agent_response.structured_output)I expect that it would behave the same as Agent.structured_output with it's return type.
Actual Behavior
Error:
def some_function(self) -> TestOutputModel:
agent = Agent(structured_output_model=TestOutputModel)
agent_response = agent("This is a test")
return agent_response.structured_output # mypy fails due to error: Incompatible return value type (got "BaseModel | None", expected "TestOutputModel") [return-value]Additional Context
No response
Possible Solution
Handle generic types for structured_output on the AgentResult
Related Issues
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working