@ -151,10 +151,11 @@ class Flow:
interactive : bool = False ,
interactive : bool = False ,
dashboard : bool = False ,
dashboard : bool = False ,
agent_name : str = " Autonomous Agent XYZ1B " ,
agent_name : str = " Autonomous Agent XYZ1B " ,
agent_description : str = None ,
system_prompt : str = FLOW_SYSTEM_PROMPT ,
system_prompt : str = FLOW_SYSTEM_PROMPT ,
# tools: List[Any] = None,
# tools: List[Any] = None,
dynamic_temperature : bool = False ,
dynamic_temperature : bool = False ,
SOP : str = None ,
sop : str = None ,
saved_state_path : Optional [ str ] = " flow_state.json " ,
saved_state_path : Optional [ str ] = " flow_state.json " ,
autosave : bool = False ,
autosave : bool = False ,
context_length : int = 8192 ,
context_length : int = 8192 ,
@ -180,13 +181,14 @@ class Flow:
self . user_name = user_name
self . user_name = user_name
self . context_length = context_length
self . context_length = context_length
# SOPS to inject into the system prompt
# SOPS to inject into the system prompt
self . SOP = SOP
self . sop = sop
# The max_loops will be set dynamically if the dynamic_loop
# The max_loops will be set dynamically if the dynamic_loop
if self . dynamic_loops :
if self . dynamic_loops :
self . max_loops = " auto "
self . max_loops = " auto "
# self.tools = tools or []
# self.tools = tools or []
self . system_prompt = system_prompt
self . system_prompt = system_prompt
self . agent_name = agent_name
self . agent_name = agent_name
self . agent_description = agent_description
self . saved_state_path = saved_state_path
self . saved_state_path = saved_state_path
self . autosave = autosave
self . autosave = autosave
self . response_filters = [ ]
self . response_filters = [ ]
@ -402,6 +404,7 @@ class Flow:
5. Repeat until stopping condition is met or max_loops is reached
5. Repeat until stopping condition is met or max_loops is reached
"""
"""
try :
# dynamic_prompt = self.construct_dynamic_prompt()
# dynamic_prompt = self.construct_dynamic_prompt()
# combined_prompt = f"{dynamic_prompt}\n{task}"
# combined_prompt = f"{dynamic_prompt}\n{task}"
@ -473,6 +476,9 @@ class Flow:
return response , history
return response , history
return response
return response
except Exception as error :
print ( f " Error running flow: { error } " )
raise
async def arun ( self , task : str , * * kwargs ) :
async def arun ( self , task : str , * * kwargs ) :
"""
"""
@ -572,10 +578,24 @@ class Flow:
Returns :
Returns :
str : The agent history prompt
str : The agent history prompt
"""
"""
if self . sop :
system_prompt = system_prompt or self . system_prompt
agent_history_prompt = f """
SYSTEM_PROMPT : { system_prompt }
Follow this standard operating procedure ( SOP ) to complete tasks :
{ self . sop }
- - - - - - - - - - - - - - - - -
History of conversations between yourself and your user { self . user_name } : { history }
"""
return agent_history_prompt
else :
system_prompt = system_prompt or self . system_prompt
system_prompt = system_prompt or self . system_prompt
agent_history_prompt = f """
agent_history_prompt = f """
SYSTEM_PROMPT : { system_prompt }
SYSTEM_PROMPT : { system_prompt }
History : { history }
History : { history }
"""
"""
return agent_history_prompt
return agent_history_prompt