Call any bb SDK method from a script with tools.bb, to read and change threads, projects, machines, environments, plugins, skills and settings of this bb. Use when a task needs bb itself rather than a machine's files or shell.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Bb Sdk?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/get-bb-bb-sdk)
---
name: bb-sdk
description: Call any bb SDK method from a script with tools.bb, to read and change threads, projects, machines, environments, plugins, skills and settings of this bb. Use when a task needs bb itself rather than a machine's files or shell.
---
# The bb SDK from a script
`tools.bb` calls one method of bb's SDK by name. It exists only inside a script.
```js
const me = await tools.bb({ method: "self" });
const threads = await tools.bb({
method: "threads.list",
args: { projectId: me.projectId },
});
```
- `method` is the dotted name below. `args` is the method's one argument, nearly always an object; leave it out when the method takes none. For the one method with two parameters, `args` is the array of them.
- The result is plain JSON, the same as the SDK returns.
- A failed call rejects with a message: a wrong name lists the nearest names, wrong arguments name each field, and a refusal by the server carries its status and message.
- `tools.bb({ method: "self" })` returns `{ threadId, projectId }` of the thread this script runs in.
- `threads.send` from a script is marked as sent by this thread unless `senderThreadId` is given. Left out, its `mode` is `"auto"`, and `prompt: "..."` is taken as an `input` of one text item.
- `threads.spawn` from a script starts the thread in this thread's project unless `projectId` is given. For a thread of this thread's provider, which a thread under this one is unless `providerId` says otherwise, `environment` may be left out and is `{ type: "project-default" }`; a thread of another provider needs one.
- `threads.list` and `environments.list` from a script return 100 at most unless `limit` is given; a list that long may go on, from `offset: 100`. For the state of many threads in one call, `threads.list` takes `threadIds`, up to 200.
- The calls have the reach of bb's owner, the same as the `bb` command on the server's own machine. Nothing asks before a delete.
- Never pass `signal`; the tool supplies it.
This page lists the names only. Before calling a method whose arguments you do not know, ask the tool for them: `await tools.bb({ method: "help", args: "threads.spawn" })` returns the whole of that one method's arguments and what it returns, and with the name of an area, such as `"threads"`, the methods of the area with the fields each takes. The same is in each area's page, to read with the skill tool, for example `references/threads.md` of this skill. An area's page names a further page for the few methods whose arguments nest deeply.
## What a script cannot call
9 of the 283 methods cannot work from a script. Calling one fails with the reason and what to use instead.
- They subscribe to live events: `experimental_desktopBrowsers.subscribe`, `subscribe`.
- They need a function as an argument: `experimental_access.pairDevice`.
- They take or return file bytes: `experimental_server.export`, `projects.attachments.read`, `projects.attachments.upload`, `system.transcribeVoice`, `threads.experimental_export`, `threads.experimental_import`.
## environments
the working copies threads run in, and their git state.
Detail in `references/environments.md`: `archiveThreads`, `commit`, `delete`, `experimental_cleanup`, `experimental_create`, `experimental_repos`, `get`, `list`, `listProviders`, `paths`, `update`
## experimental_access
who and what may sign in to this bb.
Detail in `references/experimental_access.md`: `createPairing`, `listCredentials`, ~~`pairDevice`~~, `redeemPairing`, `revokeCredential`, `session`, `setRequireSignIn`, `signOut`
## experimental_desktopBrowsers
the browser panes of the desktop app.
Detail in `references/experimental_desktopBrowsers.md`: `acquireControl`, `captureTab`, `closeTab`, `createTab`, `importCookies`, `listImportSources`, `listInstances`, `listTabs`, `openConnection`, `releaseControl`, `revealTab`, ~~`subscribe`~~
## experimental_promptHistory
the prompts a person sent before.
Detail in `references/experimental_promptHistory.md`: `list`
## experimental_server
this server's own address, sharing and updates.
Detail in `references/experimental_server.md`: `cancelMove`, `checkMove`, ~~`export`~~, `moveStatus`, `retrySweepFailures`, `startMove`, `sweepFailures`
## files
files attached to threads and projects.
Detail in `references/files.md`: `createPreview`, `list`, `listPaths`, `mkdir`, `move`, `read`, `remove`, `write`
## guide
bb's own guide text.
Detail in `references/guide.md`: `render`
## hosts
machines: list them, read their directories, manage them.
Detail in `references/hosts.md`: `cloneDefaultPath`, `createJoinCode`, `delete`, `directory`, `experimental_create`, `experimental_deleteOldServerCopy`, `experimental_discoverRepos`, `experimental_getEnrollmentCommand`, `experimental_listProviders`, `experimental_providerCliInstallJobs.get`, `experimental_providerCliInstallJobs.list`, `experimental_providerCliInstallJobs.wait`, `experimental_reconcile`, `experimental_reconnect`, `experimental_resume`, `experimental_retryCleanup`, `experimental_startProviderCliInstall`, `experimental_suspend`, `get`, `installProviderCli`, `list`, `pathsExist`, `pickFolder`, `providerCliStatus`, `retryUpdate`, `update`
## plugins
installed plugins, their settings and commands.
Detail in `references/plugins.md`: `applyUpdate`, `callRpc`, `catalog.install`, `catalog.installPlan`, `catalog.search`, `catalog.startInstall`, `catalog.status`, `checkUpdates`, `disable`, `enable`, `experimental_discoverRpc`, `experimental_getSafeMode`, `experimental_pruneCache`, `experimental_setSafeMode`, `experimental_startUpdate`, `experimental_updateJobs.get`, `experimental_updateJobs.list`, `getSettings`, `getSource`, `install`, `installJobs.cancel`, `installJobs.get`, `installJobs.list`, `list`, `listUpdateResults`, `marketplaces.add`, `marketplaces.list`, `marketplaces.refresh`, `marketplaces.remove`, `marketplaces.setEnabled`, `reload`, `remove`, `startInstall`, `token`, `updateSettings`
## projects
projects, their sources, settings and automations.
Detail in `references/projects.md`: `attachments.copy`, ~~`attachments.read`~~, ~~`attachments.upload`~~, `branches`, `commands`, `create`, `defaultExecutionOptions`, `delete`, `deleteMachineEnvironmentVariable`, `fileContent`, `files`, `get`, `list`, `machineEnvironment`, `paths`, `promptHistory`, `reorder`, `replaceMachineEnvironment`, `setMachineEnvironmentVariable`, `sidebarBootstrap`, `sources.add`, `sources.delete`, `sources.experimental_folders.add`, `sources.experimental_folders.list`, `sources.experimental_folders.remove`, `sources.experimental_folders.update`, `sources.update`, `update`
## providers
agent providers, their models and sign-in.
Detail in `references/providers.md`: `catalog`, `list`, `models`, `setEnabled`
## realtime
live events over a websocket.
Detail in `references/realtime.md`: ~~`subscribe`~~
## skills
skills: list, read, install and change them.
Detail in `references/skills.md`: `getContent`, `list`, `listFiles`, `registry.detail`, `registry.entries`, `registry.get`, `registry.install`, `registry.repositoryStars`, `registry.search`, `remove`, `update`
## status
status items shown in the app.
Detail in `references/status.md`: `get`
## system
the server's settings, version and health.
Detail in `references/system.md`: `acknowledgeAppUpdate`, `aiServices`, `applyAppUpdate`, `appUpdate`, `attention`, `cliSkillsStatus`, `config`, `deleteMachineEnvironmentVariable`, `executionOptions`, `experimental_cancelScheduledAppUpdate`, `experimental_cliCommand`, `experimental_installCliCommand`, `experimental_recordTelemetryEvent`, `experimental_removeCliCommand`, `experimental_scheduleAppUpdate`, `experimental_setAppUpdateAuto`, `installCliSkills`, `machineEnvironment`, `mobileAppDownloads`, `mobileAppReleases`, `providerStates`, `quitStatus`, `reloadConfig`, `replaceMachineEnvironment`, `setAiServiceSelection`, `setMachineEnvironmentVariable`, `testAiService`, ~~`transcribeVoice`~~, `uiPreferences.list`, `uiPreferences.reset`, `uiPreferences.set`, `updateExperiments`, `updateGeneralSettings`, `updateKeyboardSettings`, `usageLimits`, `version`
## terminals
terminal sessions, driven by create, input (base64) and output; for one command the bash tool is simpler.
Detail in `references/terminals.md`: `close`, `create`, `get`, `input`, `list`, `output`, `rename`, `resize`, `restart`
## theme
the app's theme.
Detail in `references/theme.md`: `catalog`, `get`, `resolve`, `set`
## threadSections
the sections threads are filed under.
Detail in `references/threadSections.md`: `create`, `delete`, `list`, `update`
## threads
threads: read, start, send to, stop, organise.
Detail in `references/threads.md`: `archive`, `archiveAll`, `cancelPlan`, `childSummary`, `clearContext`, `clearGoal`, `compact`, `context`, `conversationOutline`, `count`, `defaultExecutionOptions`, `delete`, `editMessage`, ~~`experimental_export`~~, `experimental_headState`, ~~`experimental_import`~~, `experimental_listAncestors`, `experimental_listCascade`, `experimental_listDescendants`, `experimental_listPluginMetadata`, `experimental_regenerateTitle`, `fork`, `get`, `getPluginMetadata`, `list`, `listRunning`, `markRead`, `markUnread`, `message`, `open`, `output`, `paneAction`, `pin`, `promptHistory`, `reorderPinned`, `resolveMentions`, `restoreEnvironment`, `retry`, `search`, `send`, `spawn`, `stop`, `storageFiles`, `storageLocation`, `storagePaths`, `timeline`, `timelineTurnSummaryDetails`, `unarchive`, `unpin`, `update`, `updatePluginMetadata`, `wait`
Detail in `references/threads.events.md`: `events.list`, `events.wait`
Detail in `references/threads.experimental_backgroundTasks.md`: `experimental_backgroundTasks.list`, `experimental_backgroundTasks.stop`
Detail in `references/threads.experimental_environments.md`: `experimental_environments.attach`, `experimental_environments.detach`, `experimental_environments.list`
Detail in `references/threads.interactions.md`: `interactions.cancel`, `interactions.get`, `interactions.list`, `interactions.resolve`, `interactions.respond`
Detail in `references/threads.queue.md`: `queue.list`
Detail in `references/threads.queuedMessages.md`: `queuedMessages.create`, `queuedMessages.delete`, `queuedMessages.experimental_holdForEdit`, `queuedMessages.experimental_releaseEditHold`, `queuedMessages.list`, `queuedMessages.reorder`, `queuedMessages.send`, `queuedMessages.setGroupBoundary`, `queuedMessages.update`
Detail in `references/threads.tabs.md`: `tabs.get`, `tabs.update`