feat: enhance input validation for Agent and Crew#4893
feat: enhance input validation for Agent and Crew#4893gilangjavier wants to merge 4 commits intocrewAIInc:mainfrom
Conversation
- Corrected "it's" to "its" in several docstrings. - Fixed missing possessive apostrophes (e.g., "agents execution" -> "agents' execution"). - Capitalized first word in attribute descriptions for consistency. - Fixed "execution the task" to "executing the task". - Updated wording in docstrings to improve clarity and consistency. These changes improve documentation quality without altering any code logic.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
This prevents noisy tracebacks showing the internal StopIteration when an unknown agent role is specified.
|
Thanks for the review! The exception chaining issue has been fixed by adding 'from None' to the ValueError raise statement. This suppresses the noisy StopIteration traceback and provides a cleaner error message. The fix has been pushed to the branch. |
|
Merged latest into this branch to resolve BEHIND status (merge commit: c0bacce). |
|
Merged latest main into this branch to resolve BEHIND status. Merge commit: c0bacce |
|
Merged main and pushed the branch update. If any required checks need to be re-triggered after the merge commit, please kick them off and I’ll address anything that comes up. |

This PR introduces stricter input validation for core components to prevent common initialization errors.
Changes:
role,goal, andbackstoryto ensure they are not empty or whitespace-only strings._create_taskto provide a descriptiveValueErrorwith available roles if a specified agent is not found, instead of a silentStopIteration.These enhancements help developers catch configuration issues early during the development phase.
Note
Low Risk
Low risk: adds stricter Pydantic validation and replaces a
StopIterationwith a clearerValueError, which may surface previously-silent misconfigurations as early failures.Overview
Adds stricter input validation for
BaseAgentby rejecting empty/whitespace-only values forrole,goal, andbackstoryat model validation time.Improves
Crewconfig task creation by raising a descriptiveValueErrorwhen a task references a missing agent role (including a list of available roles) instead of bubbling aStopIteration.Includes small docstring/field description grammar fixes in
CrewandTask.Written by Cursor Bugbot for commit 2c149b3. This will update automatically on new commits. Configure here.