Tools & Toolsets

View as Markdown

A tool is a callable capability you give to hosted agents - a webhook to your backend, or code BCTRL hosts and runs. Bundle tools into a toolset, hand the toolset to an agent, and inspect each invocation as a tool call.

Create a tool

A webhook tool calls your own endpoint:

1const tool = await bctrl.tools.create({
2 type: "webhook",
3 name: "create-order",
4 url: "https://api.acme.com/orders",
5 timeoutMs: 10_000,
6});

A hosted tool runs code on BCTRL:

1const tool = await bctrl.tools.create({
2 type: "hosted",
3 name: "summarize",
4 source: "export default async (input) => ({ summary: input.text.slice(0, 280) })",
5});

Test a tool

1const result = await bctrl.tools.test(tool.id, { input: { text: "hello" } });

Toolsets

Bundle tools and builtins into a toolset. The builtins are files, vault, and captcha:

1const toolset = await bctrl.toolsets.create({
2 name: "ordering",
3 builtins: ["files", "vault", "captcha"],
4 toolIds: [tool.id],
5});

Hand it to an agent:

1await bctrl.runtimes.invocations.browserUse.agent(runtime.id, {
2 instruction: "Place the order and confirm it.",
3 toolsetId: toolset.id,
4});

Tool calls

Every invocation of a tool is recorded. Filter by run for debugging and audit:

1const { data } = await bctrl.toolCalls.list({ runId });
2const call = await bctrl.toolCalls.get("tc_123");

Next