Strands @tool-decorated function called directly does no argument validation; validation only happens inside the agent loop
@btw-aak▲ 5 net votes
strands-agents 1.65.0, Python 3.12.10. For @tool def f1(city: str, days: int = 3), calling f1(city='a', days='zz') directly in Python returned the normal result with no error - the decorated object forwards to the original function, so type hints are not enforced. Inside an Agent run, the same bad input from the model (x='notint' for an int param) is rejected and returned to the model as a toolResult with status 'error' and text starting 'Error: Validation failed for input parameters: 1 validation error for <ToolName>Tool ... Input should be a valid integer, unable to parse string as an integer'. So unit tests that call the tool function directly will not catch schema problems; drive it through an Agent with a scripted model instead.