data
Weaviate Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the Weaviate KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.weaviate.*.
Use lua_read_doc("integrations.weaviate") 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
Weaviate workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.weaviate.list_schemas({}))' --json kosmo integrations:lua --eval 'print(docs.read("weaviate"))' --json
kosmo integrations:lua --eval 'print(docs.read("weaviate.list_schemas"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local weaviate = app.integrations.weaviate
local result = weaviate.list_schemas({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.weaviate, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.weaviate.default.* or app.integrations.weaviate.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need Weaviate, use the narrower 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.
Weaviate — Lua API Reference
list_schemas
List all schemas (collections/classes) defined in the Weaviate instance.
Parameters
None.
Example
local result = app.integrations.weaviate.list_schemas({})
for _, class in ipairs(result.classes or {}) do
print("Class: " .. class.class)
for _, prop in ipairs(class.properties or {}) do
print(" Property: " .. prop.name .. " (" .. table.concat(prop.dataType, ", ") .. ")")
end
end
get_schema
Get the schema definition for a specific class (collection).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
class_name | string | yes | The class name (e.g., "Article", "Document") |
Example
local result = app.integrations.weaviate.get_schema({
class_name = "Article"
})
print("Class: " .. result.class)
for _, prop in ipairs(result.properties or {}) do
print(" " .. prop.name .. ": " .. table.concat(prop.dataType, ", "))
end
create_class
Create a new class (collection) in the Weaviate schema.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
class | object | yes | Class definition with class (string name) and properties (array of property definitions) |
Class Definition
The class object must include:
class— the class name (PascalCase, e.g.,"Article")properties— array of property definitions, each with:name— the property name (camelCase)dataType— array of type strings (e.g.,{"text"},{"int"},{"date"})
Optional fields: description, vectorizer, moduleConfig, etc.
Example
local result = app.integrations.weaviate.create_class({
class = {
class = "Article",
description = "A news article or blog post",
properties = {
{
name = "title",
dataType = { "text" },
description = "The article title"
},
{
name = "content",
dataType = { "text" },
description = "The article body"
},
{
name = "publishedAt",
dataType = { "date" },
description = "Publication date"
}
}
}
})
print("Created class: " .. result.class)
search_objects
Search and query objects using GraphQL.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
query | string | yes | The GraphQL query string |
Example
Simple Get query
local result = app.integrations.weaviate.search_objects({
query = [[
{
Get {
Article {
title
content
}
}
}
]]
})
for _, obj in ipairs(result.data.Get.Article or {}) do
print(obj.title)
end
Get with filter
local result = app.integrations.weaviate.search_objects({
query = [[
{
Get {
Article(where: {
path: ["title"]
operator: Equal
valueText: "Introduction to Vectors"
}) {
title
content
}
}
}
]]
})
Get with limit
local result = app.integrations.weaviate.search_objects({
query = [[
{
Get {
Article(limit: 10) {
title
content
}
}
}
]]
})
create_object
Create a new data object in a Weaviate class.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
class | string | yes | The class/collection name |
properties | object | yes | Key-value pairs matching the class schema properties |
id | string | no | Optional UUID for the object |
Example
local result = app.integrations.weaviate.create_object({
class = "Article",
properties = {
title = "Introduction to Vector Databases",
content = "Vector databases enable semantic search by storing embeddings...",
publishedAt = "2026-04-06T12:00:00Z"
}
})
print("Created object: " .. result.id)
Create with explicit UUID
local result = app.integrations.weaviate.create_object({
class = "Article",
properties = {
title = "Another Article",
content = "More content here..."
},
id = "550e8400-e29b-41d4-a716-446655440000"
})
get_object
Retrieve a specific data object by class name and UUID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
class_name | string | yes | The class/collection name |
id | string | yes | The UUID of the object |
Example
local result = app.integrations.weaviate.get_object({
class_name = "Article",
id = "550e8400-e29b-41d4-a716-446655440000"
})
print("Title: " .. result.properties.title)
print("Class: " .. result.class)
print("Created: " .. result.creationTimeUnix)
get_health
Check the health and liveness of the Weaviate instance.
Parameters
None.
Example
local result = app.integrations.weaviate.get_health({})
print("Status: " .. (result.status or "unknown"))
Multi-Account Usage
If you have multiple Weaviate instances configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.weaviate.function_name({...})
-- Explicit default (portable across setups)
app.integrations.weaviate.default.function_name({...})
-- Named accounts
app.integrations.weaviate.production.function_name({...})
app.integrations.weaviate.staging.function_name({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# Weaviate — Lua API Reference
## list_schemas
List all schemas (collections/classes) defined in the Weaviate instance.
### Parameters
None.
### Example
```lua
local result = app.integrations.weaviate.list_schemas({})
for _, class in ipairs(result.classes or {}) do
print("Class: " .. class.class)
for _, prop in ipairs(class.properties or {}) do
print(" Property: " .. prop.name .. " (" .. table.concat(prop.dataType, ", ") .. ")")
end
end
```
---
## get_schema
Get the schema definition for a specific class (collection).
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `class_name` | string | yes | The class name (e.g., `"Article"`, `"Document"`) |
### Example
```lua
local result = app.integrations.weaviate.get_schema({
class_name = "Article"
})
print("Class: " .. result.class)
for _, prop in ipairs(result.properties or {}) do
print(" " .. prop.name .. ": " .. table.concat(prop.dataType, ", "))
end
```
---
## create_class
Create a new class (collection) in the Weaviate schema.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `class` | object | yes | Class definition with `class` (string name) and `properties` (array of property definitions) |
### Class Definition
The `class` object must include:
- `class` — the class name (PascalCase, e.g., `"Article"`)
- `properties` — array of property definitions, each with:
- `name` — the property name (camelCase)
- `dataType` — array of type strings (e.g., `{"text"}`, `{"int"}`, `{"date"}`)
Optional fields: `description`, `vectorizer`, `moduleConfig`, etc.
### Example
```lua
local result = app.integrations.weaviate.create_class({
class = {
class = "Article",
description = "A news article or blog post",
properties = {
{
name = "title",
dataType = { "text" },
description = "The article title"
},
{
name = "content",
dataType = { "text" },
description = "The article body"
},
{
name = "publishedAt",
dataType = { "date" },
description = "Publication date"
}
}
}
})
print("Created class: " .. result.class)
```
---
## search_objects
Search and query objects using GraphQL.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `query` | string | yes | The GraphQL query string |
### Example
### Simple Get query
```lua
local result = app.integrations.weaviate.search_objects({
query = [[
{
Get {
Article {
title
content
}
}
}
]]
})
for _, obj in ipairs(result.data.Get.Article or {}) do
print(obj.title)
end
```
### Get with filter
```lua
local result = app.integrations.weaviate.search_objects({
query = [[
{
Get {
Article(where: {
path: ["title"]
operator: Equal
valueText: "Introduction to Vectors"
}) {
title
content
}
}
}
]]
})
```
### Get with limit
```lua
local result = app.integrations.weaviate.search_objects({
query = [[
{
Get {
Article(limit: 10) {
title
content
}
}
}
]]
})
```
---
## create_object
Create a new data object in a Weaviate class.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `class` | string | yes | The class/collection name |
| `properties` | object | yes | Key-value pairs matching the class schema properties |
| `id` | string | no | Optional UUID for the object |
### Example
```lua
local result = app.integrations.weaviate.create_object({
class = "Article",
properties = {
title = "Introduction to Vector Databases",
content = "Vector databases enable semantic search by storing embeddings...",
publishedAt = "2026-04-06T12:00:00Z"
}
})
print("Created object: " .. result.id)
```
### Create with explicit UUID
```lua
local result = app.integrations.weaviate.create_object({
class = "Article",
properties = {
title = "Another Article",
content = "More content here..."
},
id = "550e8400-e29b-41d4-a716-446655440000"
})
```
---
## get_object
Retrieve a specific data object by class name and UUID.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `class_name` | string | yes | The class/collection name |
| `id` | string | yes | The UUID of the object |
### Example
```lua
local result = app.integrations.weaviate.get_object({
class_name = "Article",
id = "550e8400-e29b-41d4-a716-446655440000"
})
print("Title: " .. result.properties.title)
print("Class: " .. result.class)
print("Created: " .. result.creationTimeUnix)
```
---
## get_health
Check the health and liveness of the Weaviate instance.
### Parameters
None.
### Example
```lua
local result = app.integrations.weaviate.get_health({})
print("Status: " .. (result.status or "unknown"))
```
---
## Multi-Account Usage
If you have multiple Weaviate instances configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.weaviate.function_name({...})
-- Explicit default (portable across setups)
app.integrations.weaviate.default.function_name({...})
-- Named accounts
app.integrations.weaviate.production.function_name({...})
app.integrations.weaviate.staging.function_name({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.weaviate.list_schemas({})
print(result) Functions
list_schemas Read
List all schemas (collections/classes) defined in the Weaviate instance. Returns the full schema including all classes and their properties.
- Lua path
app.integrations.weaviate.list_schemas- Full name
weaviate.weaviate_list_schemas
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_schema Read
Get the schema definition for a specific class (collection) in Weaviate. Returns the class name, properties, vectorizer config, and module settings.
- Lua path
app.integrations.weaviate.get_schema- Full name
weaviate.weaviate_get_schema
| Parameter | Type | Required | Description |
|---|---|---|---|
class_name | string | yes | The name of the class/collection to retrieve the schema for (e.g., "Article", "Document"). |
create_class Write
Create a new class (collection) in the Weaviate schema. Provide a class definition with the class name and an array of property definitions (name, dataType, etc.).
- Lua path
app.integrations.weaviate.create_class- Full name
weaviate.weaviate_create_class
| Parameter | Type | Required | Description |
|---|---|---|---|
class | object | yes | The class definition object. Must include "class" (string name) and "properties" (array of property definitions). Each property needs "name" (string) and "dataType" (array of strings, e.g., ["text"]). |
search_objects Read
Search and query objects in Weaviate using GraphQL. Supports Get, Aggregate, and Explore queries with filters, sorting, and vector/nearVector/nearText search.
- Lua path
app.integrations.weaviate.search_objects- Full name
weaviate.weaviate_search_objects
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | yes | The GraphQL query string to execute against the Weaviate GraphQL endpoint. E.g.: { Get { Article { title content } } } |
create_object Write
Create a new data object in a Weaviate class. Provide the class name and a properties object with the data fields. Optionally specify a UUID for the object.
- Lua path
app.integrations.weaviate.create_object- Full name
weaviate.weaviate_create_object
| Parameter | Type | Required | Description |
|---|---|---|---|
class | string | yes | The class/collection name to create the object in (e.g., "Article", "Document"). |
properties | object | yes | The object properties as key-value pairs. Keys must match the property names defined in the class schema. |
id | string | no | Optional UUID for the object. If not provided, Weaviate will auto-generate one. |
get_object Read
Retrieve a specific data object from Weaviate by its class name and UUID. Returns the full object including all properties and metadata.
- Lua path
app.integrations.weaviate.get_object- Full name
weaviate.weaviate_get_object
| Parameter | Type | Required | Description |
|---|---|---|---|
class_name | string | yes | The class/collection name the object belongs to (e.g., "Article", "Document"). |
id | string | yes | The UUID of the object to retrieve. |
get_health Read
Check the health and liveness of the Weaviate instance. Returns a status indicating whether the service is alive and responsive.
- Lua path
app.integrations.weaviate.get_health- Full name
weaviate.weaviate_get_health
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||