@@ -844,26 +844,22 @@ async def run(
844844 if prepare_request is not None :
845845 if not callable (prepare_request ):
846846 raise TypeError ("prepare_request must be callable" )
847- _check_output (_prepare_spec (self .output_type ))
848- effective_provider = self .provider if provider is None else provider
849- if effective_provider is not None and not isinstance (
850- effective_provider , NativeProvider
851- ):
852- raise TypeError ("provider must be a NativeProvider or None" )
853- _check_profile (
854- self ,
855- websockets = True
856- if effective_provider is None
857- else effective_provider ._websockets_enabled ,
858- environment = environment ,
859- )
860- if (
861- tools is None
862- and before_step is None
863- and state is None
864- and getattr (self .session , "__func__" , None ) is Agent .session
865- ):
866- _check_tools (self .tools )
847+ if getattr (self .session , "__func__" , None ) is Agent .session :
848+ _check_output (_prepare_spec (self .output_type ))
849+ effective_provider = self .provider if provider is None else provider
850+ if effective_provider is not None and not isinstance (
851+ effective_provider , NativeProvider
852+ ):
853+ raise TypeError ("provider must be a NativeProvider or None" )
854+ _check_profile (
855+ self ,
856+ websockets = True
857+ if effective_provider is None
858+ else effective_provider ._websockets_enabled ,
859+ environment = environment ,
860+ )
861+ if tools is None and before_step is None and state is None :
862+ _check_tools (self .tools )
867863 if on_interaction is not None and not callable (on_interaction ):
868864 raise TypeError ("on_interaction must be callable" )
869865 if not isinstance (return_state , bool ):
0 commit comments