@@ -50,7 +50,7 @@ const stagehandConfig: ConstructorParams = {
50
50
: "LOCAL" ,
51
51
apiKey : process . env . BROWSERBASE_API_KEY /* API key for authentication */ ,
52
52
projectId : process . env . BROWSERBASE_PROJECT_ID /* Project identifier */ ,
53
- debugDom : true /* Enable DOM debugging features */ ,
53
+ debugDom : false /* Enable DOM debugging features */ ,
54
54
headless : false /* Run browser in headless mode */ ,
55
55
logger : ( message : LogLine ) =>
56
56
console . error ( logLineToString ( message ) ) /* Custom logging function to stderr */ ,
@@ -65,6 +65,7 @@ const stagehandConfig: ConstructorParams = {
65
65
modelClientOptions : {
66
66
apiKey : process . env . OPENAI_API_KEY ,
67
67
} /* Configuration options for the model client */ ,
68
+ useAPI : false ,
68
69
} ;
69
70
70
71
// Define the Stagehand tools
@@ -368,6 +369,7 @@ async function handleToolCall(
368
369
await stagehand . page . act ( {
369
370
action : args . action ,
370
371
variables : args . variables ,
372
+ slowDomBasedAct : false ,
371
373
} ) ;
372
374
// log("Action completed successfully", 'info');
373
375
return {
@@ -403,9 +405,10 @@ async function handleToolCall(
403
405
// log(`Schema: ${JSON.stringify(args.schema)}`, 'debug');
404
406
// Convert the JSON schema from args.schema to a zod schema
405
407
const zodSchema = jsonSchemaToZod ( args . schema ) as AnyZodObject ;
406
- const data = await stagehand . extract ( {
408
+ const data = await stagehand . page . extract ( {
407
409
instruction : args . instruction ,
408
410
schema : zodSchema ,
411
+ useTextExtract : true ,
409
412
} ) ;
410
413
if ( ! data || typeof data !== "object" || ! ( "data" in data ) ) {
411
414
throw new Error ( "Invalid extraction response format" ) ;
0 commit comments