@@ -1113,13 +1113,13 @@ def _single_server_call(self, *, payload: Dict[str, Any]) -> ValidationOutcome[O
11131113                    validation_passed = False ,
11141114                    error = "The response from the server was empty!" ,
11151115                )
1116- 
1117-             # TODO reenable this when we have history support in 
1118-             # multi-node server environments 
1119-             # guard_history = self._api_client.get_history( 
1120-             #       self.name, validation_output.call_id 
1121-             # ) 
1122-             # self.history.extend([Call.from_interface(call) for call in guard_history] )
1116+              if   os . environ . get ( "GUARD_HISTORY_ENABLED" ,  "true" ). lower ()  ==   "true" : 
1117+                  guard_history   =   self . _api_client . get_history ( 
1118+                      self . name ,  validation_output . call_id 
1119+                 ) 
1120+                 self .history . extend ( 
1121+                     [ Call . from_interface ( call )  for   call   in   guard_history ] 
1122+                  )
11231123
11241124            validation_summaries  =  []
11251125            if  self .history .last  and  self .history .last .iterations .last :
@@ -1184,13 +1184,14 @@ def _stream_server_call(
11841184                    )
11851185
11861186            # TODO reenable this when sever supports multi-node history 
1187-             # if validation_output: 
1188-             #     guard_history = self._api_client.get_history( 
1189-             #         self.name, validation_output.call_id 
1190-             #     ) 
1191-             # self.history.extend( 
1192-             #     [Call.from_interface(call) for call in guard_history] 
1193-             # ) 
1187+             if  os .environ .get ("GUARD_HISTORY_ENABLED" , "true" ).lower () ==  "true" :
1188+                 if  validation_output :
1189+                     guard_history  =  self ._api_client .get_history (
1190+                         self .name , validation_output .call_id 
1191+                     )
1192+                 self .history .extend (
1193+                     [Call .from_interface (call ) for  call  in  guard_history ]
1194+                 )
11941195        else :
11951196            raise  ValueError ("Guard does not have an api client!" )
11961197
0 commit comments