Skip to content

InvokeBrowser

Source: src/AWS/BedrockAgentCore/InvokeBrowser.ts

Performs an OS-level browser action (mouse, keyboard, screenshot) in a session.

OS-level actions cover interactions the Chrome DevTools Protocol cannot reach — print dialogs, context menus, and JavaScript alerts.

Bind a BrowserCustom inside a function runtime to call the AgentCore data-plane API against it. Provide AgentCore.InvokeBrowserHttp on the Function effect to implement the binding.

// init
const invokeBrowser = yield* AgentCore.InvokeBrowser(browser);
return {
fetch: Effect.gen(function* () {
// runtime
const result = yield* invokeBrowser({
sessionId,
action: { screenshot: {} },
});
return HttpServerResponse.json({ result: result.result });
}),
};