Core Concepts
Browser Workflows
Learn how the browser fits into a sandbox workflow, when to use direct browser controls, and when to let the AI agent drive the browser instead.
In Banata, the browser is part of the sandbox.
That means:
- the browser shares the same job context as the files
- the AI agent can use that browser
- a person can take over the same browser later
- the workflow does not have to jump between disconnected tools
What browser workflows are good for
Use the browser when the job needs a real web session:
- visiting pages
- reading page content
- logging in
- clicking through workflows
- downloading or uploading files
- pausing for human approval
Preview basics
ts
const preview = await sandbox.getPreview();
const viewerUrl = await sandbox.getPreviewViewerUrl();The preview is mainly for:
- watching the agent work
- debugging
- manual verification
- human handoff
Direct browser controls
Banata also exposes direct browser controls for known actions.
ts
await sandbox.startPreview();
await sandbox.navigatePreview("https://example.com");
await sandbox.resizePreview({ width: 1440, height: 900 });Use direct controls when:
- your app already knows the target page
- the next action is deterministic
Agent-driven browser work
Use the AI agent when the browser task is open-ended or multi-step.
ts
const queued = await sandbox.promptAsync(
"Open the target site, collect the key information, save the findings to /workspace/summary.txt, and reply when done.",
);Use the agent when the job involves:
- reading content
- deciding which page matters next
- following links
- combining browser work with file work
When to choose direct control vs agent control
Use direct browser methods when:
- you want a specific page open
- the workflow is deterministic
Use the AI agent when:
- the browser task includes judgment
- the workflow spans several pages
- the browser is only one part of a larger job