Skip to content

StartBrowserSession

Source: src/AWS/BedrockAgentCore/StartBrowserSession.ts

Starts a managed, sandboxed browser session on a custom browser.

Bind a BrowserCustom inside a function runtime to open cloud browser sessions for web automation; pair with GetBrowserSession, InvokeBrowser, and StopBrowserSession. Provide AgentCore.StartBrowserSessionHttp on the Function effect to implement the binding.

// init
const startBrowserSession = yield* AgentCore.StartBrowserSession(browser);
const stopBrowserSession = yield* AgentCore.StopBrowserSession(browser);
return {
fetch: Effect.gen(function* () {
// runtime
const session = yield* startBrowserSession({
sessionTimeout: "5 minutes",
});
yield* stopBrowserSession({ sessionId: session.sessionId });
return HttpServerResponse.json({ sessionId: session.sessionId });
}),
};