KosmoKrator

other

Weaviate Lua API for KosmoKrator Agents

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

7 functions 5 read 2 write API key auth

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.

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

NameTypeRequiredDescription
class_namestringyesThe 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

NameTypeRequiredDescription
classobjectyesClass 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

NameTypeRequiredDescription
querystringyesThe 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

NameTypeRequiredDescription
classstringyesThe class/collection name
propertiesobjectyesKey-value pairs matching the class schema properties
idstringnoOptional 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

NameTypeRequiredDescription
class_namestringyesThe class/collection name
idstringyesThe 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.

Metadata-Derived Lua Example

local result = app.integrations.weaviate.weaviate_list_schemas({})
print(result)

Functions

weaviate_list_schemas

List all schemas (collections/classes) defined in the Weaviate instance. Returns the full schema including all classes and their properties.

Operation
Read read
Full name
weaviate.weaviate_list_schemas
ParameterTypeRequiredDescription
No parameters.

weaviate_get_schema

Get the schema definition for a specific class (collection) in Weaviate. Returns the class name, properties, vectorizer config, and module settings.

Operation
Read read
Full name
weaviate.weaviate_get_schema
ParameterTypeRequiredDescription
class_name string yes The name of the class/collection to retrieve the schema for (e.g., "Article", "Document").

weaviate_create_class

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.).

Operation
Write write
Full name
weaviate.weaviate_create_class
ParameterTypeRequiredDescription
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"]).

weaviate_search_objects

Search and query objects in Weaviate using GraphQL. Supports Get, Aggregate, and Explore queries with filters, sorting, and vector/nearVector/nearText search.

Operation
Read read
Full name
weaviate.weaviate_search_objects
ParameterTypeRequiredDescription
query string yes The GraphQL query string to execute against the Weaviate GraphQL endpoint. E.g.: { Get { Article { title content } } }

weaviate_create_object

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.

Operation
Write write
Full name
weaviate.weaviate_create_object
ParameterTypeRequiredDescription
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.

weaviate_get_object

Retrieve a specific data object from Weaviate by its class name and UUID. Returns the full object including all properties and metadata.

Operation
Read read
Full name
weaviate.weaviate_get_object
ParameterTypeRequiredDescription
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.

weaviate_get_health

Check the health and liveness of the Weaviate instance. Returns a status indicating whether the service is alive and responsive.

Operation
Read read
Full name
weaviate.weaviate_get_health
ParameterTypeRequiredDescription
No parameters.