Skip to content

Commit 8565249

Browse files
authored
Es/screenshot number clarity (#76)
* Provide more clarity on step number for screenshots * Lint and format * Changeset
1 parent b701624 commit 8565249

11 files changed

Lines changed: 32 additions & 67 deletions

File tree

.changeset/vast-hands-type.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
"@trymeka/computer-provider-anchor-browser": patch
3+
"@trymeka/computer-provider-scrapybara": patch
4+
"@trymeka/computer-provider-core": patch
5+
"@trymeka/computer-provider-e2b": patch
6+
"@trymeka/ai-provider-vercel": patch
7+
"@trymeka/core": patch
8+
---
9+
10+
Give the agent clarity on screenshot numbers

packages/ai-provider-vercel/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@
66
"access": "public"
77
},
88
"description": "TODO: Add description",
9-
"keywords": [
10-
"trymeka"
11-
],
9+
"keywords": ["trymeka"],
1210
"repository": {
1311
"type": "git",
1412
"url": "git+https://github.com/trymeka/agent.git",
1513
"directory": "packages/ai-provider-vercel"
1614
},
1715
"license": "MIT",
1816
"homepage": "https://github.com/trymeka/agent/tree/main/packages/ai-provider-vercel#readme",
19-
"files": [
20-
"dist",
21-
"!dist/**/*.map",
22-
"README.md"
23-
],
17+
"files": ["dist", "!dist/**/*.map", "README.md"],
2418
"exports": {
2519
".": {
2620
"types": "./dist/index.d.ts",

packages/computer-provider-anchor-browser/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@
66
"access": "public"
77
},
88
"description": "TODO: Add description",
9-
"keywords": [
10-
"trymeka"
11-
],
9+
"keywords": ["trymeka"],
1210
"repository": {
1311
"type": "git",
1412
"url": "git+https://github.com/trymeka/agent.git",
1513
"directory": "packages/computer-provider-anchor-browser"
1614
},
1715
"license": "MIT",
1816
"homepage": "https://github.com/trymeka/agent/tree/main/packages/computer-provider-anchor-browser#readme",
19-
"files": [
20-
"dist",
21-
"!dist/**/*.map",
22-
"README.md"
23-
],
17+
"files": ["dist", "!dist/**/*.map", "README.md"],
2418
"exports": {
2519
".": {
2620
"types": "./dist/index.d.ts",

packages/computer-provider-core/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@
66
"access": "public"
77
},
88
"description": "TODO: Add description",
9-
"keywords": [
10-
"trymeka"
11-
],
9+
"keywords": ["trymeka"],
1210
"repository": {
1311
"type": "git",
1412
"url": "git+https://github.com/trymeka/agent.git",
1513
"directory": "packages/computer-provider-core"
1614
},
1715
"license": "MIT",
1816
"homepage": "https://github.com/trymeka/agent/tree/main/packages/computer-provider-core#readme",
19-
"files": [
20-
"dist",
21-
"!dist/**/*.map",
22-
"README.md"
23-
],
17+
"files": ["dist", "!dist/**/*.map", "README.md"],
2418
"exports": {
2519
".": {
2620
"types": "./dist/index.d.ts",

packages/computer-provider-e2b/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@
66
"access": "public"
77
},
88
"description": "TODO: Add description",
9-
"keywords": [
10-
"trymeka"
11-
],
9+
"keywords": ["trymeka"],
1210
"repository": {
1311
"type": "git",
1412
"url": "git+https://github.com/trymeka/agent.git",
1513
"directory": "packages/computer-provider-e2b"
1614
},
1715
"license": "MIT",
1816
"homepage": "https://github.com/trymeka/agent/tree/main/packages/computer-provider-e2b#readme",
19-
"files": [
20-
"dist",
21-
"!dist/**/*.map",
22-
"README.md"
23-
],
17+
"files": ["dist", "!dist/**/*.map", "README.md"],
2418
"exports": {
2519
".": {
2620
"types": "./dist/index.d.ts",

packages/computer-provider-scrapybara/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@
66
"access": "public"
77
},
88
"description": "TODO: Add description",
9-
"keywords": [
10-
"trymeka"
11-
],
9+
"keywords": ["trymeka"],
1210
"repository": {
1311
"type": "git",
1412
"url": "git+https://github.com/trymeka/agent.git",
1513
"directory": "packages/computer-provider-scrapybara"
1614
},
1715
"license": "MIT",
1816
"homepage": "https://github.com/trymeka/agent/tree/main/packages/computer-provider-scrapybara#readme",
19-
"files": [
20-
"dist",
21-
"!dist/**/*.map",
22-
"README.md"
23-
],
17+
"files": ["dist", "!dist/**/*.map", "README.md"],
2418
"exports": {
2519
".": {
2620
"types": "./dist/index.d.ts",

packages/core/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,15 @@
66
"access": "public"
77
},
88
"description": "TODO: Add description",
9-
"keywords": [
10-
"trymeka"
11-
],
9+
"keywords": ["trymeka"],
1210
"repository": {
1311
"type": "git",
1412
"url": "git+https://github.com/trymeka/agent.git",
1513
"directory": "packages/agent"
1614
},
1715
"license": "MIT",
1816
"homepage": "https://github.com/trymeka/agent/tree/main/packages/agent#readme",
19-
"files": [
20-
"dist",
21-
"!dist/**/*.map",
22-
"README.md"
23-
],
17+
"files": ["dist", "!dist/**/*.map", "README.md"],
2418
"exports": {
2519
".": {
2620
"typescript": "./src/index.ts",

packages/core/src/ai/agent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,8 @@ export function createAgent<T, R>(options: {
420420
{
421421
type: "text",
422422
text: `${task.instructions}
423-
424-
Here is the current state of the screen:`,
423+
424+
Starting screenshot:`,
425425
},
426426
{
427427
type: "image",

packages/core/src/ai/prompts/system.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ IMPORTANT: You can interact with the ENTIRE computer screen, not just the browse
5353
5454
5. **Handle Obstacles Efficiently**: If you encounter obstacles that prevent completing the user's instructions, address them quickly or inform the user rather than continuing unsuccessfully.
5555
56-
6. **Context Awareness**: You have access to the most recent 7 steps and conversation history. Screenshots are labeled with step numbers (e.g., "Screenshot at Step 3") so you can track progress and avoid repeating failed actions from earlier steps.
56+
6. **Context Awareness**: You have access to the most recent 7 steps and conversation history. Screenshots are labeled with step numbers (e.g., "Screenshot at Step 3") so you can track progress and avoid repeating failed actions from earlier steps. Always reference the highest step number screenshot to understand the current page state.
5757
5858
7. **Be exhaustive in your analysis and execution**: Think carefully about your approach, and remember that pages may require scrolling to see all elements. Something important that you are looking for may be hidden out of view and you should scroll to find it.
5959

packages/core/src/tools/computer.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export function createComputerTool<T, R>({
365365
execute: async (args, context) => {
366366
const result = await computerProvider.performAction(args.action, context);
367367

368-
// Smart delay with network idle support
368+
// Smart delay with network idle support for navigation actions only
369369
if (args.action.type === "click" || args.action.type === "double_click") {
370370
try {
371371
const instance = await computerProvider.getInstance(
@@ -374,23 +374,14 @@ export function createComputerTool<T, R>({
374374
const page = (instance as { page?: Page })?.page;
375375

376376
if (page?.waitForLoadState) {
377-
await page.waitForLoadState("networkidle", { timeout: 1500 });
378-
} else {
379-
await new Promise((resolve) => setTimeout(resolve, 1500));
377+
await page.waitForLoadState("networkidle", { timeout: 1000 });
380378
}
379+
// No fallback delay - if network idle doesn't work, proceed immediately
381380
} catch {
382-
await new Promise((resolve) => setTimeout(resolve, 1500));
381+
// No fallback delay on error - proceed immediately
383382
}
384-
} else {
385-
// Other action types get fixed delays
386-
const delay =
387-
args.action.type === "type"
388-
? 300
389-
: args.action.type === "scroll"
390-
? 800
391-
: 500;
392-
await new Promise((resolve) => setTimeout(resolve, delay));
393383
}
384+
// No delays for other action types - proceed immediately
394385

395386
const screenshot = await computerProvider.takeScreenshot(
396387
context.sessionId,
@@ -415,7 +406,7 @@ export function createComputerTool<T, R>({
415406
},
416407
{
417408
type: "text" as const,
418-
text: `Computer action on ${result.timestamp}, result: ${result.actionPerformed}. Reasoning: ${result.reasoning} Screenshot as attached.`,
409+
text: `Computer action completed: ${result.actionPerformed}. Step ${context.step} screenshot attached.`,
419410
},
420411
{
421412
type: "image" as const,

0 commit comments

Comments
 (0)