> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://platform.bctrl.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://platform.bctrl.ai/_mcp/server.

# Run a Hosted Agent

> Give a browser-use agent a task in plain language - no Playwright, no framework, no CDP connection.

The zero-framework path: create a runtime, hand it an instruction, read the answer. The agent runs inside the runtime on BCTRL infrastructure - your process just waits for the result, and the whole session is recorded on the [run](/sdk/runs) like any other.

```ts
import { Bctrl } from "@bctrl/sdk";

const bctrl = new Bctrl({ apiKey: process.env.BCTRL_API_KEY! });

const runtime = await bctrl.runtimes.create({
  type: "browser",
  name: "agent-recipe",
  config: { stealth: "high" },
});
const { runId } = await bctrl.runtimes.start(runtime.id);

const invocation = await bctrl.runtimes.invocations.createAndWait(
  runtime.id,
  {
    action: "browserUse",
    instruction:
      "Go to news.ycombinator.com and summarize the top three stories, with links.",
    maxSteps: 25,
    useVision: "auto",
  },
  { timeoutMs: 300_000 }
);

console.log(invocation.status);
console.log(invocation.output);

await bctrl.runtimes.stop(runtime.id);

// Proof of work: replay exactly what the agent did.
const recording = await bctrl.runs.recording(runId);
console.log("Replay:", recording.url);
```

> 📸 **Content TODO:** screenshot of the recording viewer scrubbed to mid-task, captioned "what the agent actually did" - the replay-as-proof framing is the hook here.

While it runs, everything from the other recipes applies: [watch it live](/cookbook/embed-live-view), [stream its events](/cookbook/react-to-events), or solve the [CAPTCHA](/cookbook/solve-captchas) it hits - or grant the `captcha` builtin via a [toolset](/sdk/tools) and it solves them itself.

## Choosing a model

By default the space's configured model is used. Override per call with a managed model string, or your own key via a saved [AI credential](/sdk/ai):

```ts
{
  action: "browserUse",
  instruction: "...",
  model: "openai/gpt-5",
}
```

browser-use exposes deeper controls when you need them - `enablePlanning`, `maxFailures`, `stepTimeoutMs`, `sensitiveData` - see [Hosted agents](/sdk/hosted-agents).

## Next

* [Hosted agents](/sdk/hosted-agents) - the full agent surface
* [Stagehand on BCTRL](/cookbook/stagehand) - finer-grained act/observe/extract control
* [Give an Agent Custom Tools](/cookbook/custom-tools) - let it call your backend