Skip to content

本页尚未翻译

本页内容仍为英文原文,源自官方文档 basics/agentic-skills。中文翻译正在分批进行中。

Agentic skills ​

Give a coding agent a current, maintained reference for the LanceDB APIs.

A coding agent writing LanceDB code from memory writes whatever was in its training data: often an older API, sometimes one that never existed. The LanceDB agent plugin fixes that by supplying the current reference at the point the agent needs it.

The plugin ​

It ships as the lancedb plugin in the lancedb-agent-plugins repository, which is also a plugin marketplace. Install it with your agent's plugin manager:

text
/plugin marketplace add lancedb/lancedb-agent-plugins
/plugin install lancedb@lancedb
bash
codex plugin marketplace add lancedb/lancedb-agent-plugins
codex plugin add lancedb@lancedb
bash
npx plugins add lancedb/lancedb-agent-plugins

The plugins installer shown under Other agents is a cross-tool option. It detects which agent CLIs are on your PATH (Cursor, GitHub Copilot CLI, VS Code, Grok Build, and Kimi Code, as well as Claude Code and Codex) and installs through each one's native plugin system.

The plugin supplements the agent's training data with current LanceDB instructions. To pick up later revisions, refresh the marketplace:

text
/plugin marketplace update lancedb
bash
codex plugin marketplace upgrade
bash
npx plugins add lancedb/lancedb-agent-plugins
Where the plugin gets installed

Each plugin manager clones the repository, reads its marketplace manifest to find the lancedb plugin, and hands the plugin to the agent's own plugin store rather than copying files into your project. Claude Code and Codex keep it under ~/.claude/plugins and ~/.codex/plugins respectively, so the plugin is available in every project on the machine.

The npx plugins installer defaults to the same user-wide scope. Pass --scope project to record the plugin in the current repository instead, so that everyone working in it gets the same plugin, or -t <target> to install for a single agent rather than every one it detects:

bash
npx plugins add lancedb/lancedb-agent-plugins --scope project -t cursor

Not every agent supports project scope; npx plugins targets lists what it found and what each target supports.

Example prompts ​

These prompts show the kind of work the plugin helps an agent get right on the first try. Adapt the dataset names, columns, and models to your own data.

Ingest and search robotics data ​

text
Import the HuggingFace dataset `lance-format/koch_pick_place_5_lego-lance`
into LanceDB.

Create a Function `extract_frames(video, timestamp)` that extracts each frame
from the videos table and stores the output as JPEG in a Lance blob column.
Use `torchcodec` to decode frames on a GPU, and stream the video through the
blob input instead of loading it into memory. Install dependencies with pip,
not conda.

Create a table `koch_frames` from `extract_frames`, populated from the videos
and frames metadata in the existing tables.

Create a Function that uses a vision-language model to caption each frame,
and add its output as a column named `caption` on `koch_frames`. It needs a
GPU.

Create a full-text search index on `koch_frames.caption`.

Deduplicate near-identical images ​

text
Import the HuggingFace dataset `lance-format/BDD100K-enriched` into LanceDB.

Create a Function `phash(image)` that computes a perceptual hash with the
`ImageHash` package, and add it as a column named `phash`.

Build a vector index on `phash` using Hamming distance, and pick good index
parameters for this dataset size.

Create a materialized view that clusters images whose `phash` Hamming
distance is less than 1, using `duplicate_pairs`.

Summarize the result: cluster count, cluster size distribution, and the 10
largest clusters with sample image ids.

Ingest a large code dataset ​

text
Import the C, C++, and Python metadata from the HuggingFace dataset
`bigcode/the-stack-v2` into a single table `stack_v2_code`, with an extra
`language` column recording which of the three it is.

Add a `content` column and backfill it with each file's source, downloaded
from `s3://softwareheritage/content/{blob_id}` using the `blob_id` already in
the table. Compress `content` with the best codec LanceDB supports for code
text.

Use `bigcode/starcoder2-3b` to add a `perplexity_starcoder2` column, then
build an index on it.