Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ Not every provider's native computer-use vocabulary includes browser
navigation — some models can click and type but have no direct way to open a
URL or go back. `computerUseExtra: true` adds `computer_use_extra`, a
provider-neutral escape hatch exposing `goto`, `back`, `forward`, and `url`
so navigation works uniformly regardless of which model is driving.
so navigation works uniformly regardless of which model is driving. No
screenshot is returned automatically; request one on a follow-up turn when
the model needs to see the page.

Some steps are awkward as raw pointer/keyboard actions: precise DOM reads,
form fills, data extraction, or waiting on a specific selector.
Expand Down
6 changes: 1 addition & 5 deletions packages/agent/src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,8 @@ async function executeNavigationTool(translator: InternalComputerTranslator, par
} else {
await translator.executeBatch([{ type: action }]);
}
const screenshot = await translator.screenshot();
return {
content: [
{ type: "text", text: statusText },
{ type: "image", data: screenshot.data.toString("base64"), mimeType: screenshot.mimeType },
],
content: [{ type: "text", text: statusText }],
details: { action, statusText, ...(url ? { url } : {}) },
};
} catch (err) {
Expand Down
24 changes: 24 additions & 0 deletions packages/agent/test/tool-exhaustiveness.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,30 @@ describe("Cua tool executor coverage", () => {
expect(result.content.at(-1)).toMatchObject({ type: "image", mimeType: "image/png" });
});

it("runs computer_use_extra without auto-appending a screenshot", async () => {
const runtime = resolveCuaRuntimeSpec("openai:gpt-5.5");
const tools = createCuaComputerTools({
browser,
client: {
browsers: {
computer: {
batch: async () => undefined,
captureScreenshot: async () => new Response(tinyPng),
},
},
} as unknown as Kernel,
toolExecutors: runtime.toolExecutors,
computerUseExtra: true,
});
const nav = tools.find((tool) => tool.name === "computer_use_extra");
expect(nav).toBeDefined();

const result = await nav!.execute("call_1", { action: "back" });

expect(result.content).toEqual([{ type: "text", text: "back executed successfully." }]);
expect(result.details).toMatchObject({ action: "back", statusText: "back executed successfully." });
});

it("runs the playwright_execute tool and returns result + stdout as tool content", async () => {
const calls: Array<{ id: string; body: { code: string; timeout_sec?: number } }> = [];
const runtime = resolveCuaRuntimeSpec("openai:gpt-5.5");
Expand Down
Loading