Skip to content
Back to skills

Sandbox Tfjs

ASecurity

Classify and embed images, detect objects, and answer from a passage in a Code node or CodeAct action, with TensorFlow.js running on the host

  • 552 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 1, 2026
ai-agentsgonodebackend

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 1, 2026

npx -y skills add nodetool-ai/nodetool --skill sandbox-tfjs --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Sandbox Tfjs?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Sandbox Tfjs
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nodetool-ai-sandbox-tfjs/badge)](https://www.skillsdirectory.com/skills/nodetool-ai-sandbox-tfjs)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: sandbox-tfjs
description: Classify and embed images, detect objects, and answer from a passage in a Code node or CodeAct action, with TensorFlow.js running on the host
---

# TensorFlow.js models in the sandbox

Specifier: `@nodetool-ai/sandbox-tfjs`. Import it at the top of the body.

The models are tens of megabytes of weights, fetched over the network and kept
between calls. The guest has neither the heap for them nor a way to keep
anything alive past a run, so this pack is a **host module**: the import
resolves to a generated facade over NodeTool's own implementation, and each
model loads once per process.

These models are small, local, and free — that is the whole reason to reach for
them. For anything a description or a caption would answer better, use a vision
model through `nodetool.media` instead.

## classify — ImageNet labels

```js
import { classify } from "@nodetool-ai/sandbox-tfjs";

const labels = await classify(await workspace.readBytes("photo.jpg"), { topK: 3 });
return { best: labels[0].className, probability: labels[0].probability };
```

MobileNet v2 over the 1000 ImageNet classes, most likely first. `topK` defaults
to 5.

## embed — a feature vector for an image

```js
import { embed } from "@nodetool-ai/sandbox-tfjs";

const vector = await embed(bytes);   // 1280 numbers
```

The MobileNet penultimate layer. Compare two vectors by cosine similarity for
near-duplicate detection or nearest-neighbour search.

## detect — objects with boxes

```js
import { detect } from "@nodetool-ai/sandbox-tfjs";

const objects = await detect(bytes, { maxBoxes: 10, minScore: 0.6 });
// [{ className: "person", score: 0.91, bbox: { x, y, width, height } }, …]
```

COCO-SSD over the 80 COCO classes. The box is in image pixels. `maxBoxes`
defaults to 20 and `minScore` to 0.5.

## answer — extractive question answering

```js
import { answer } from "@nodetool-ai/sandbox-tfjs";

const spans = await answer("When was it founded?", inputs.article);
return { answer: spans[0]?.text ?? null };
```

BERT QnA quotes the passage — it never writes prose. Each span carries a
`score` and its `startIndex`/`endIndex` in the passage.

## Gotchas

- **Every export is async**, and the first call to each model waits for its
  weights to download.
- **Images go in as encoded bytes** (PNG/JPEG/WebP), decoded through the
  sandbox's own `image` backend — so the same pixel caps `image.decode`
  enforces apply, and 10 MB is the input limit.
- **The models see pixels, nothing else.** `classify` on a screenshot of text
  answers with an ImageNet class, not with the text; that is
  `@nodetool-ai/sandbox-ocr`.

Files in this skill

  • SKILL.md2.6 KB
  • package.json949 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.