KosmoKrator

data

Qdrant Lua API for KosmoKrator Agents

Agent-facing Lua documentation and function reference for the Qdrant KosmoKrator integration.

Lua Namespace

Agents call this integration through app.integrations.qdrant.*. Use lua_read_doc("integrations.qdrant") inside KosmoKrator to discover the same reference at runtime.

Call Lua from the Headless CLI

Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic Qdrant workflow without starting an interactive agent session.

Inline Lua call
kosmo integrations:lua --eval 'dump(app.integrations.qdrant.list_collections({}))' --json
Read Lua docs headlessly
kosmo integrations:lua --eval 'print(docs.read("qdrant"))' --json
kosmo integrations:lua --eval 'print(docs.read("qdrant.list_collections"))' --json

Workflow file

Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.

workflow.lua
local qdrant = app.integrations.qdrant
local result = qdrant.list_collections({})

dump(result)
Run the workflow
kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json
Namespace note. integrations:lua exposes app.integrations.qdrant, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.qdrant.default.* or app.integrations.qdrant.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Qdrant, use the narrower mcp:lua command.

MCP Lua command
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json

Agent-Facing Lua Docs

This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.

Qdrant — Lua API Reference

Namespace: app.integrations.qdrant

Collections

local collections = app.integrations.qdrant.list_collections({})

local info = app.integrations.qdrant.get_collection({
  name = "documents"
})

app.integrations.qdrant.create_collection({
  name = "documents",
  vectors = { size = 1536, distance = "Cosine" }
})

app.integrations.qdrant.delete_collection({
  name = "documents",
  timeout = 30
})

Points

app.integrations.qdrant.upsert_points({
  collection = "documents",
  points = {
    { id = 1, vector = {0.1, 0.2}, payload = { title = "Doc 1" } }
  },
  wait = true
})

local search = app.integrations.qdrant.search({
  collection = "documents",
  vector = {0.1, 0.2},
  limit = 5,
  with_payload = true
})

local query = app.integrations.qdrant.query_points({
  collection = "documents",
  query = {0.1, 0.2},
  limit = 5,
  with_payload = true
})

local retrieved = app.integrations.qdrant.retrieve_points({
  collection = "documents",
  ids = {1, 2},
  with_payload = true
})

local page = app.integrations.qdrant.scroll_points({
  collection = "documents",
  limit = 100,
  with_payload = true
})

local count = app.integrations.qdrant.count_points({
  collection = "documents",
  filter = {
    must = {
      { key = "category", match = { value = "docs" } }
    }
  },
  exact = true
})

Use delete_points with either points or filter.

Payloads And Indexes

app.integrations.qdrant.set_payload({
  collection = "documents",
  points = {1},
  payload = { reviewed = true }
})

app.integrations.qdrant.delete_payload({
  collection = "documents",
  points = {1},
  keys = {"reviewed"}
})

app.integrations.qdrant.clear_payload({
  collection = "documents",
  points = {1}
})

app.integrations.qdrant.create_payload_index({
  collection = "documents",
  field_name = "category",
  field_schema = "keyword"
})

Aliases, Cluster, Snapshots

local cluster = app.integrations.qdrant.get_cluster_info({})
local aliases = app.integrations.qdrant.list_aliases({})
local collection_aliases = app.integrations.qdrant.list_collection_aliases({
  collection = "documents"
})

app.integrations.qdrant.update_aliases({
  actions = {
    { create_alias = { collection_name = "documents", alias_name = "active_docs" } }
  }
})

local snapshots = app.integrations.qdrant.list_snapshots({
  collection = "documents"
})

local snapshot = app.integrations.qdrant.create_snapshot({
  collection = "documents"
})

Multi-Account Usage

app.integrations.qdrant.list_collections({})
app.integrations.qdrant.default.list_collections({})
app.integrations.qdrant.production.list_collections({})
Raw agent markdown
# Qdrant — Lua API Reference

Namespace: `app.integrations.qdrant`

## Collections

```lua
local collections = app.integrations.qdrant.list_collections({})

local info = app.integrations.qdrant.get_collection({
  name = "documents"
})

app.integrations.qdrant.create_collection({
  name = "documents",
  vectors = { size = 1536, distance = "Cosine" }
})

app.integrations.qdrant.delete_collection({
  name = "documents",
  timeout = 30
})
```

## Points

```lua
app.integrations.qdrant.upsert_points({
  collection = "documents",
  points = {
    { id = 1, vector = {0.1, 0.2}, payload = { title = "Doc 1" } }
  },
  wait = true
})

local search = app.integrations.qdrant.search({
  collection = "documents",
  vector = {0.1, 0.2},
  limit = 5,
  with_payload = true
})

local query = app.integrations.qdrant.query_points({
  collection = "documents",
  query = {0.1, 0.2},
  limit = 5,
  with_payload = true
})

local retrieved = app.integrations.qdrant.retrieve_points({
  collection = "documents",
  ids = {1, 2},
  with_payload = true
})

local page = app.integrations.qdrant.scroll_points({
  collection = "documents",
  limit = 100,
  with_payload = true
})

local count = app.integrations.qdrant.count_points({
  collection = "documents",
  filter = {
    must = {
      { key = "category", match = { value = "docs" } }
    }
  },
  exact = true
})
```

Use `delete_points` with either `points` or `filter`.

## Payloads And Indexes

```lua
app.integrations.qdrant.set_payload({
  collection = "documents",
  points = {1},
  payload = { reviewed = true }
})

app.integrations.qdrant.delete_payload({
  collection = "documents",
  points = {1},
  keys = {"reviewed"}
})

app.integrations.qdrant.clear_payload({
  collection = "documents",
  points = {1}
})

app.integrations.qdrant.create_payload_index({
  collection = "documents",
  field_name = "category",
  field_schema = "keyword"
})
```

## Aliases, Cluster, Snapshots

```lua
local cluster = app.integrations.qdrant.get_cluster_info({})
local aliases = app.integrations.qdrant.list_aliases({})
local collection_aliases = app.integrations.qdrant.list_collection_aliases({
  collection = "documents"
})

app.integrations.qdrant.update_aliases({
  actions = {
    { create_alias = { collection_name = "documents", alias_name = "active_docs" } }
  }
})

local snapshots = app.integrations.qdrant.list_snapshots({
  collection = "documents"
})

local snapshot = app.integrations.qdrant.create_snapshot({
  collection = "documents"
})
```

## Multi-Account Usage

```lua
app.integrations.qdrant.list_collections({})
app.integrations.qdrant.default.list_collections({})
app.integrations.qdrant.production.list_collections({})
```
Metadata-derived Lua example
local result = app.integrations.qdrant.list_collections({})
print(result)

Functions

list_collections Read

List all vector collections in the Qdrant cluster. Returns collection names and basic metadata.

Lua path
app.integrations.qdrant.list_collections
Full name
qdrant.qdrant_list_collections
ParameterTypeRequiredDescription
No parameters.
get_collection Read

Get detailed information about a specific Qdrant collection, including vector configuration, index status, and point count.

Lua path
app.integrations.qdrant.get_collection
Full name
qdrant.qdrant_get_collection
ParameterTypeRequiredDescription
name string yes The name of the collection to retrieve.
create_collection Write

Create a new vector collection in Qdrant. You must specify the vector configuration (size, distance metric). Optionally provide HNSW, quantization, and optimization settings.

Lua path
app.integrations.qdrant.create_collection
Full name
qdrant.qdrant_create_collection
ParameterTypeRequiredDescription
name string yes Name for the new collection.
vectors object yes Vector configuration. Example: {"size": 1536, "distance": "Cosine"}. Distance options: Cosine, Euclid, Dot.
hnsw_config object no HNSW index configuration (e.g., {"m": 16, "ef_construct": 100}).
optimizers_config object no Optimizer configuration (e.g., {"indexing_threshold": 20000}).
quantization_config object no Quantization configuration for memory savings (scalar or product).
replication_factor integer no Number of replicas for each shard (default: 1).
shard_number integer no Number of shards for the collection (default: 1 for single-node).
delete_collection Write

Delete a Qdrant collection and all of its points.

Lua path
app.integrations.qdrant.delete_collection
Full name
qdrant.qdrant_delete_collection
ParameterTypeRequiredDescription
name string yes Collection name.
timeout integer no Optional operation timeout in seconds.
search_points Read

Search for the closest vectors in a Qdrant collection. Supports vector similarity search with optional filtering, payload selection, and scoring.

Lua path
app.integrations.qdrant.search_points
Full name
qdrant.qdrant_search
ParameterTypeRequiredDescription
collection string yes The collection name to search in.
vector array no The query vector (array of floats). Use this for direct vector search.
vector_name string no Named vector to search against (for multi-vector collections).
filter object no Filter conditions to narrow results. JSON object with "must", "should", "must_not" clauses.
limit integer no Maximum number of results to return (default: 10).
offset integer no Offset for pagination.
with_payload boolean no Whether to include point payloads in results (default: true).
with_vectors boolean no Whether to include vectors in results (default: false).
score_threshold number no Minimum similarity score threshold. Results below this are excluded.
query_points Read

Use Qdrant Query API for nearest, recommend, discover, fusion, or multi-stage vector queries.

Lua path
app.integrations.qdrant.query_points
Full name
qdrant.qdrant_query_points
ParameterTypeRequiredDescription
collection string yes Collection name.
query object no Query object or vector.
using string no Named vector to query.
filter object no Qdrant filter object.
params object no Search params.
limit integer no Maximum results.
offset integer no Pagination offset.
with_payload boolean no Include payloads.
with_vector boolean no Include vectors.
score_threshold number no Minimum score threshold.
retrieve_points Read

Retrieve Qdrant points by IDs with optional payload and vector selection.

Lua path
app.integrations.qdrant.retrieve_points
Full name
qdrant.qdrant_retrieve_points
ParameterTypeRequiredDescription
collection string yes Collection name.
ids array yes Point IDs to retrieve.
with_payload boolean no Include payloads.
with_vector boolean no Include vectors.
scroll_points Read

Scroll Qdrant points with optional filters, payload selection, and offset pagination.

Lua path
app.integrations.qdrant.scroll_points
Full name
qdrant.qdrant_scroll_points
ParameterTypeRequiredDescription
collection string yes Collection name.
filter object no Optional filter.
limit integer no Page size.
offset string no Next offset from the previous response.
with_payload boolean no Include payloads.
with_vector boolean no Include vectors.
count_points Read

Count points in a Qdrant collection, optionally matching a filter exactly or approximately.

Lua path
app.integrations.qdrant.count_points
Full name
qdrant.qdrant_count_points
ParameterTypeRequiredDescription
collection string yes Collection name.
filter object no Optional filter.
exact boolean no Whether to count exactly.
upsert_points Write

Insert or update points (vectors with optional payloads) in a Qdrant collection. Each point requires an ID and a vector. Payloads are optional metadata.

Lua path
app.integrations.qdrant.upsert_points
Full name
qdrant.qdrant_upsert_points
ParameterTypeRequiredDescription
collection string yes The collection name to upsert points into.
points array yes Array of point objects. Each point must have "id" (integer or UUID string), "vector" (array of floats), and optionally "payload" (object with metadata).
wait boolean no Whether to wait for the operation to complete (default: true).
ordering string no Write ordering guarantee: "weak" or "strong" (default: "weak").
delete_points Write

Delete Qdrant points by point IDs or filter selector.

Lua path
app.integrations.qdrant.delete_points
Full name
qdrant.qdrant_delete_points
ParameterTypeRequiredDescription
collection string yes Collection name.
points array no Point IDs to delete.
filter object no Filter selector for points to delete.
wait boolean no Wait for completion.
ordering string no Write ordering guarantee.
set_payload Write

Set payload values on Qdrant points selected by IDs or filter.

Lua path
app.integrations.qdrant.set_payload
Full name
qdrant.qdrant_set_payload
ParameterTypeRequiredDescription
collection string yes Collection name.
payload object yes Payload values to set.
points array no Point IDs to update.
filter object no Filter selector.
wait boolean no Wait for completion.
delete_payload Write

Delete specific payload keys from points selected by IDs or filter.

Lua path
app.integrations.qdrant.delete_payload
Full name
qdrant.qdrant_delete_payload
ParameterTypeRequiredDescription
collection string yes Collection name.
keys array yes Payload keys to delete.
points array no Point IDs to update.
filter object no Filter selector.
wait boolean no Wait for completion.
clear_payload Write

Clear all payload fields from points selected by IDs or filter.

Lua path
app.integrations.qdrant.clear_payload
Full name
qdrant.qdrant_clear_payload
ParameterTypeRequiredDescription
collection string yes Collection name.
points array no Point IDs to update.
filter object no Filter selector.
wait boolean no Wait for completion.
create_payload_index Write

Create a payload index for a collection field to speed up filtering.

Lua path
app.integrations.qdrant.create_payload_index
Full name
qdrant.qdrant_create_payload_index
ParameterTypeRequiredDescription
collection string yes Collection name.
field_name string yes Payload field name.
field_schema object yes Qdrant field schema, e.g. keyword, integer, float, geo, bool, datetime, uuid, or text.
delete_payload_index Write

Delete a payload index from a Qdrant collection field.

Lua path
app.integrations.qdrant.delete_payload_index
Full name
qdrant.qdrant_delete_payload_index
ParameterTypeRequiredDescription
collection string yes Collection name.
field_name string yes Payload field name.
get_cluster_info Read

Get Qdrant cluster information, including peer state and cluster status where available.

Lua path
app.integrations.qdrant.get_cluster_info
Full name
qdrant.qdrant_get_cluster_info
ParameterTypeRequiredDescription
No parameters.
list_aliases Read

List all Qdrant collection aliases in the cluster.

Lua path
app.integrations.qdrant.list_aliases
Full name
qdrant.qdrant_list_aliases
ParameterTypeRequiredDescription
No parameters.
list_collection_aliases Read

List aliases attached to one Qdrant collection.

Lua path
app.integrations.qdrant.list_collection_aliases
Full name
qdrant.qdrant_list_collection_aliases
ParameterTypeRequiredDescription
collection string yes Collection name.
update_aliases Write

Atomically create, delete, or rename Qdrant collection aliases.

Lua path
app.integrations.qdrant.update_aliases
Full name
qdrant.qdrant_update_aliases
ParameterTypeRequiredDescription
actions array yes Alias operation actions.
list_snapshots Read

List collection snapshots available in Qdrant.

Lua path
app.integrations.qdrant.list_snapshots
Full name
qdrant.qdrant_list_snapshots
ParameterTypeRequiredDescription
collection string yes Collection name.
create_snapshot Write

Create a snapshot for a Qdrant collection.

Lua path
app.integrations.qdrant.create_snapshot
Full name
qdrant.qdrant_create_snapshot
ParameterTypeRequiredDescription
collection string yes Collection name.