@@ -209,7 +209,7 @@ class Agent:
209
209
# Use these for few-shot learning or to provide additional context to the Model.
210
210
# Note: these are not retained in memory, they are added directly to the messages sent to the model.
211
211
add_messages : Optional [List [Union [Dict , Message ]]] = None
212
-
212
+ success_criteria : Optional [ str ] = None
213
213
# --- User message settings ---
214
214
# Provide the user message as a string, list, dict, or function
215
215
# Note: this will ignore the message sent to the run function
@@ -328,6 +328,7 @@ def __init__(
328
328
create_default_system_message : bool = True ,
329
329
description : Optional [str ] = None ,
330
330
goal : Optional [str ] = None ,
331
+ success_criteria : Optional [str ] = None ,
331
332
instructions : Optional [Union [str , List [str ], Callable ]] = None ,
332
333
expected_output : Optional [str ] = None ,
333
334
additional_context : Optional [str ] = None ,
@@ -419,6 +420,7 @@ def __init__(
419
420
420
421
self .description = description
421
422
self .goal = goal
423
+ self .success_criteria = success_criteria
422
424
self .instructions = instructions
423
425
self .expected_output = expected_output
424
426
self .additional_context = additional_context
@@ -2928,6 +2930,12 @@ def get_system_message(self, session_id: str, user_id: Optional[str] = None) ->
2928
2930
system_message_content += (
2929
2931
f"<transfer_instructions>\n { self .get_transfer_instructions ().strip ()} \n </transfer_instructions>\n \n "
2930
2932
)
2933
+ if self .success_criteria :
2934
+ system_message_content += "Your task is successful when the following criteria is met:\n "
2935
+ system_message_content += "<success_criteria>\n "
2936
+ system_message_content += f"{ self .success_criteria } \n "
2937
+ system_message_content += "</success_criteria>\n "
2938
+ system_message_content += "Stop running when the success_criteria is met.\n \n "
2931
2939
# 3.3.10 Then add memories to the system prompt
2932
2940
if self .memory :
2933
2941
if isinstance (self .memory , AgentMemory ) and self .memory .create_user_memories :
0 commit comments