-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Problem Description
The Agent
class in the SDK currently exhibits two critical issues related to its instructions
field:
-
Optional
instructions
Field: Theinstructions
parameter for theAgent
class is currently optional. This design choice allows for the creation of agents without any defined purpose or behavior, leading to unpredictable outcomes and making the agent's functionality ambiguous. An agent's instructions are fundamental to its operation and should be mandatory for proper instantiation. -
Acceptance of Non-String Types for
instructions
: Theinstructions
field currently accepts data types other thanstring
(e.g., integers, booleans, lists, dictionaries). This violates type safety principles and the inherent purpose ofinstructions
, which are intended to be natural language directives for the underlying Language Model (LLM). Passing non-string values can lead to runtime errors, misinterpretations by the LLM, or silent failures that are difficult to debug.
Expected Behavior
instructions
should be a required parameter: TheAgent
constructor should enforce thatinstructions
is always provided upon instantiation.instructions
should strictly enforcestr
type: Theinstructions
parameter should only accept astring
data type. Any attempt to pass a non-string value should result in aTypeError
or a similar clear validation error at the point of instantiation.
Proposed Solution
To resolve these issues and make the Agents SDK
more robust and intuitive for all users, I propose the following:
- Make
instructions
a Mandatory Setting: TheAgent
should always requireinstructions
when it's created. This ensures every agent has a clear purpose from the start. - Ensure
instructions
Only Accepts Text: Implement a check to make sure that theinstructions
are always provided as a string (text). If anything else is given (like numbers or other data types), the SDK should immediately show an error, guiding the user to provide valid input.
Addressing these points would significantly enhance the robustness, predictability, and overall user-friendliness of the Agents SDK
, especially for developers integrating the library.