Invocations

View as Markdown

Invocations ask BCTRL-hosted agents to do work inside a runtime. They are different from CDP connections:

  • Connections are for external tools like Playwright, Puppeteer, Selenium, and debuggers.
  • Invocations are for hosted AI work such as Stagehand or browser-use agent execution.

Create an invocation

1const invocation = await runtime.invocations.create({
2 provider: "stagehand",
3 operation: "agent.execute",
4 input: {
5 instruction: "Find the invoice total on the current page.",
6 },
7});

Wait for completion

1const result = await space.invocations.wait(invocation.id, {
2 timeoutMs: 60_000,
3});

Observe the run

Invocations write to the runtime’s active run.

1const run = await runtime.currentRun();
2
3const { events } = await run.events.list();
4const { commands } = await run.commands.list();
5const { artifacts } = await run.artifacts.list();