Skip to content

Commit 92a36ff

Browse files
committed
Update Clean Up Process
Updated browser clean up process + added more robust error messasging to the output.
1 parent 3fa6bef commit 92a36ff

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const TEMPLATES: Record<TemplateKey, TemplateInfo> = {
9090
},
9191
[TEMPLATE_GEMINI_CUA]: {
9292
name: "Gemini Computer Use",
93-
description: "Implements Gemini 2.5 Computer Use Agent with Stagehand",
93+
description: "Implements Gemini 2.5 Computer Use Agent",
9494
languages: [LANGUAGE_TYPESCRIPT],
9595
},
9696
};

templates/typescript/gemini-cua/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const app = kernel.app('ts-gemini-cua');
1010
interface SearchQueryOutput {
1111
success: boolean;
1212
result: string;
13+
error?: string;
1314
}
1415

1516
// API Keys for LLM providers
@@ -84,16 +85,15 @@ async function runStagehandTask(invocationId?: string): Promise<SearchQueryOutpu
8485

8586
console.log("result: ", result);
8687

87-
console.log("Deleting browser and closing stagehand...");
88-
await stagehand.close();
89-
await kernel.browsers.deleteByID(kernelBrowser.session_id);
9088
return { success: true, result: result.message };
9189
} catch (error) {
9290
console.error(error);
91+
const errorMessage = error instanceof Error ? error.message : String(error);
92+
return { success: false, result: "", error: errorMessage };
93+
} finally {
9394
console.log("Deleting browser and closing stagehand...");
9495
await stagehand.close();
9596
await kernel.browsers.deleteByID(kernelBrowser.session_id);
96-
return { success: false, result: "" };
9797
}
9898
}
9999

0 commit comments

Comments
 (0)