@@ -211,10 +211,12 @@ export class Execution {
211211 throw new Error ( "Teach mode requires a workflow to execute" ) ;
212212 }
213213
214- // Check if BrowserOS provider is selected
214+ // Check if BrowserOS provider is selected and websocket agent feature is enabled
215215 const providerType = await langChainProvider . getCurrentProviderType ( ) || '' ;
216+ const featureFlags = getFeatureFlags ( ) ;
217+ const wsAgentEnabled = featureFlags . isEnabled ( 'WEBSOCKET_AGENT' ) ;
216218
217- if ( providerType === 'browseros' ) {
219+ if ( providerType === 'browseros' && wsAgentEnabled ) {
218220 // Use TeachWebSocketAgent for teach mode with BrowserOS provider
219221 agentType = 'TeachWebSocketAgent' ;
220222 Logging . logMetric ( 'execution.agent_start' , {
@@ -252,11 +254,13 @@ export class Execution {
252254 const chatAgent = new ChatAgent ( executionContext ) ;
253255 await chatAgent . execute ( query ) ;
254256 } else {
255- // Browse mode - check if BrowserOS mode is enabled
257+ // Browse mode - check if BrowserOS mode is enabled and websocket agent feature is enabled
256258 const providerType = await langChainProvider . getCurrentProviderType ( ) || '' ;
259+ const featureFlags = getFeatureFlags ( ) ;
260+ const wsAgentEnabled = featureFlags . isEnabled ( 'WEBSOCKET_AGENT' ) ;
257261
258- // Use WebSocketAgent only when BrowserOS provider is selected
259- if ( providerType === 'browseros' ) {
262+ // Use WebSocketAgent only when BrowserOS provider is selected and feature is enabled
263+ if ( providerType === 'browseros' && wsAgentEnabled ) {
260264 agentType = 'WebSocketAgent' ;
261265 Logging . logMetric ( 'execution.agent_start' , {
262266 mode : this . options . mode ,
@@ -329,11 +333,18 @@ export class Execution {
329333 if ( this . options . mode === 'chat' ) {
330334 agentName = 'ChatAgent' ;
331335 } else if ( this . options . mode === 'teach' ) {
332- agentName = 'TeachAgent' ;
336+ // Check if TeachWebSocketAgent was used
337+ const providerType = await langChainProvider . getCurrentProviderType ( ) || '' ;
338+ const featureFlags = getFeatureFlags ( ) ;
339+ const wsAgentEnabled = featureFlags . isEnabled ( 'WEBSOCKET_AGENT' ) ;
340+ agentName = ( providerType === 'browseros' && wsAgentEnabled ) ? 'TeachWebSocketAgent' : 'TeachAgent' ;
333341 } else {
334342 // Browse mode - check which agent was used
335343 const providerType = await langChainProvider . getCurrentProviderType ( ) || '' ;
336- if ( providerType === 'browseros' ) {
344+ const featureFlags = getFeatureFlags ( ) ;
345+ const wsAgentEnabled = featureFlags . isEnabled ( 'WEBSOCKET_AGENT' ) ;
346+
347+ if ( providerType === 'browseros' && wsAgentEnabled ) {
337348 agentName = 'WebSocketAgent' ;
338349 } else {
339350 const smallModelsList = [ 'ollama' ] ;
0 commit comments