Control the computer’s mouse, keyboard, and screen
Use OS-level controls to move and click the mouse, type and press keys, scroll, drag, and capture screenshots from a running browser session.
Computer control actions are only available for browsers created after October 15, 2025. Older persistent browser instances do not support these features.
Simulate mouse clicks at specific coordinates. You can select the button, click type (down, up, click), number of clicks, and optional modifier keys to hold.
Copy
Ask AI
import Kernel from '@onkernel/sdk';const kernel = new Kernel();const kernelBrowser = await kernel.browsers.create();// Basic left click at (100, 200)await kernel.browsers.computer.clickMouse(kernelBrowser.session_id, { x: 100, y: 200,});// Double right-click while holding Shiftawait kernel.browsers.computer.clickMouse(kernelBrowser.session_id, { x: 100, y: 200, button: 'right', click_type: 'click', num_clicks: 2, hold_keys: ['Shift'],});
Press one or more key symbols (including combinations like “Ctrl+t” or “Ctrl+Shift+Tab”). Optionally hold modifiers and/or set a duration to hold keys down.
Copy
Ask AI
import Kernel from '@onkernel/sdk';const kernel = new Kernel();const kernelBrowser = await kernel.browsers.create();// Tap a key combinationawait kernel.browsers.computer.pressKey(kernelBrowser.session_id, { keys: ['Ctrl+t'],});// Hold keys for 250ms while also holding Altawait kernel.browsers.computer.pressKey(kernelBrowser.session_id, { keys: ['Ctrl+Shift+Tab'], duration: 250, hold_keys: ['Alt'],});
Drag by pressing a button, moving along a path of points, then releasing. You can control delay before starting, the granularity and speed of the drag via steps_per_segment and step_delay_ms, and optionally hold modifier keys.