KosmoKrator

productivity

Split Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write Bearer token auth

Lua Namespace

Agents call this integration through app.integrations.split.*. Use lua_read_doc("integrations.split") 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.

Split — Lua API Reference

list_splits

List feature splits in a Split workspace.

Parameters

NameTypeRequiredDescription
workspace_idstringnoWorkspace ID (defaults to configured workspace)
limitintegernoMax splits to return (default: 20, max: 100)
offsetintegernoPagination offset (default: 0)

Examples

-- List splits in default workspace
local result = app.integrations.split.list_splits({})

for _, split in ipairs(result.splits) do
  print(split.name .. " (" .. split.trafficTypeName .. ")")
end

-- Paginated listing
local result = app.integrations.split.list_splits({
  limit = 50,
  offset = 0
})

-- Specific workspace
local result = app.integrations.split.list_splits({
  workspace_id = "abc123"
})

get_split

Get detailed information about a specific feature split.

Parameters

NameTypeRequiredDescription
split_namestringyesThe split name, e.g. "new-checkout-flow"
workspace_idstringnoWorkspace ID (defaults to configured workspace)

Examples

local result = app.integrations.split.get_split({
  split_name = "new-checkout-flow"
})

print("Split: " .. result.name)
print("Traffic Type: " .. result.trafficTypeName)
print("Killed: " .. tostring(result.killed))
print("Treatments: " .. #result.treatments)

create_split

Create a new feature split in a workspace.

Parameters

NameTypeRequiredDescription
namestringyesThe split name
traffic_type_namestringyesTraffic type name, e.g. "user"
descriptionstringnoOptional description
workspace_idstringnoWorkspace ID (defaults to configured workspace)

Examples

-- Create a basic split
local result = app.integrations.split.create_split({
  name = "new-checkout-flow",
  traffic_type_name = "user"
})
print(result.message)

-- Create with description
local result = app.integrations.split.create_split({
  name = "new-pricing-page",
  traffic_type_name = "user",
  description = "Controls the new pricing page rollout"
})
print(result.message)

list_environments

List all environments for a Split workspace.

Parameters

NameTypeRequiredDescription
workspace_idstringnoWorkspace ID (defaults to configured workspace)

Examples

local result = app.integrations.split.list_environments({})

for _, env in ipairs(result.environments) do
  print(env.id .. ": " .. env.name .. " (" .. env.type .. ")")
end

get_environment

Get detailed information about a specific Split environment.

Parameters

NameTypeRequiredDescription
environment_idstringyesThe environment ID
workspace_idstringnoWorkspace ID (defaults to configured workspace)

Examples

local result = app.integrations.split.get_environment({
  environment_id = "env-123"
})

print("Environment: " .. result.name)
print("Type: " .. result.type)
print("Status: " .. result.status)

list_workspaces

List all Split workspaces.

Parameters

This tool takes no parameters.

Examples

local result = app.integrations.split.list_workspaces({})

for _, ws in ipairs(result.workspaces) do
  print(ws.id .. ": " .. ws.name)
end

get_current_user

Get the currently authenticated Split user.

Parameters

This tool takes no parameters.

Examples

local result = app.integrations.split.get_current_user({})

print("User: " .. result.name)
print("Email: " .. result.email)
print("Type: " .. result.type)

Multi-Account Usage

If you have multiple Split accounts configured, use account-specific namespaces:

-- Default account (always works)
app.integrations.split.function_name({...})

-- Explicit default (portable across setups)
app.integrations.split.default.function_name({...})

-- Named accounts
app.integrations.split.production.function_name({...})
app.integrations.split.staging.function_name({...})

All functions are identical across accounts — only the credentials differ.

Raw agent markdown
# Split — Lua API Reference

## list_splits

List feature splits in a Split workspace.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `workspace_id` | string | no | Workspace ID (defaults to configured workspace) |
| `limit` | integer | no | Max splits to return (default: 20, max: 100) |
| `offset` | integer | no | Pagination offset (default: 0) |

### Examples

```lua
-- List splits in default workspace
local result = app.integrations.split.list_splits({})

for _, split in ipairs(result.splits) do
  print(split.name .. " (" .. split.trafficTypeName .. ")")
end

-- Paginated listing
local result = app.integrations.split.list_splits({
  limit = 50,
  offset = 0
})

-- Specific workspace
local result = app.integrations.split.list_splits({
  workspace_id = "abc123"
})
```

---

## get_split

Get detailed information about a specific feature split.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `split_name` | string | yes | The split name, e.g. `"new-checkout-flow"` |
| `workspace_id` | string | no | Workspace ID (defaults to configured workspace) |

### Examples

```lua
local result = app.integrations.split.get_split({
  split_name = "new-checkout-flow"
})

print("Split: " .. result.name)
print("Traffic Type: " .. result.trafficTypeName)
print("Killed: " .. tostring(result.killed))
print("Treatments: " .. #result.treatments)
```

---

## create_split

Create a new feature split in a workspace.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | The split name |
| `traffic_type_name` | string | yes | Traffic type name, e.g. `"user"` |
| `description` | string | no | Optional description |
| `workspace_id` | string | no | Workspace ID (defaults to configured workspace) |

### Examples

```lua
-- Create a basic split
local result = app.integrations.split.create_split({
  name = "new-checkout-flow",
  traffic_type_name = "user"
})
print(result.message)

-- Create with description
local result = app.integrations.split.create_split({
  name = "new-pricing-page",
  traffic_type_name = "user",
  description = "Controls the new pricing page rollout"
})
print(result.message)
```

---

## list_environments

List all environments for a Split workspace.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `workspace_id` | string | no | Workspace ID (defaults to configured workspace) |

### Examples

```lua
local result = app.integrations.split.list_environments({})

for _, env in ipairs(result.environments) do
  print(env.id .. ": " .. env.name .. " (" .. env.type .. ")")
end
```

---

## get_environment

Get detailed information about a specific Split environment.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `environment_id` | string | yes | The environment ID |
| `workspace_id` | string | no | Workspace ID (defaults to configured workspace) |

### Examples

```lua
local result = app.integrations.split.get_environment({
  environment_id = "env-123"
})

print("Environment: " .. result.name)
print("Type: " .. result.type)
print("Status: " .. result.status)
```

---

## list_workspaces

List all Split workspaces.

### Parameters

This tool takes no parameters.

### Examples

```lua
local result = app.integrations.split.list_workspaces({})

for _, ws in ipairs(result.workspaces) do
  print(ws.id .. ": " .. ws.name)
end
```

---

## get_current_user

Get the currently authenticated Split user.

### Parameters

This tool takes no parameters.

### Examples

```lua
local result = app.integrations.split.get_current_user({})

print("User: " .. result.name)
print("Email: " .. result.email)
print("Type: " .. result.type)
```

---

## Multi-Account Usage

If you have multiple Split accounts configured, use account-specific namespaces:

```lua
-- Default account (always works)
app.integrations.split.function_name({...})

-- Explicit default (portable across setups)
app.integrations.split.default.function_name({...})

-- Named accounts
app.integrations.split.production.function_name({...})
app.integrations.split.staging.function_name({...})
```

All functions are identical across accounts — only the credentials differ.

Metadata-Derived Lua Example

local result = app.integrations.split.split_list_splits({
  workspace_id = "example_workspace_id",
  limit = 1,
  offset = 1
})
print(result)

Functions

split_list_splits

List feature splits in a Split workspace. Returns split names, descriptions, traffic type, and creation date.

Operation
Read read
Full name
split.split_list_splits
ParameterTypeRequiredDescription
workspace_id string no The workspace ID (defaults to the configured workspace).
limit integer no Maximum number of splits to return (default: 20, max: 100).
offset integer no Offset for pagination (default: 0).

split_get_split

Get detailed information about a specific Split feature split, including its definition and traffic allocation.

Operation
Read read
Full name
split.split_get_split
ParameterTypeRequiredDescription
split_name string yes The split name (e.g., "new-checkout-flow").
workspace_id string no The workspace ID (defaults to the configured workspace).

split_create_split

Create a new feature split in a Split workspace. Specify a name, traffic type, and optional description.

Operation
Write write
Full name
split.split_create_split
ParameterTypeRequiredDescription
name string yes The split name (e.g., "new-checkout-flow").
traffic_type_name string yes The traffic type name (e.g., "user", "account").
description string no Optional description for the split.
workspace_id string no The workspace ID (defaults to the configured workspace).

split_list_environments

List all environments for a Split workspace. Returns environment IDs, names, and their status.

Operation
Read read
Full name
split.split_list_environments
ParameterTypeRequiredDescription
workspace_id string no The workspace ID (defaults to the configured workspace).

split_get_environment

Get detailed information about a specific Split environment, including its name, type, and status.

Operation
Read read
Full name
split.split_get_environment
ParameterTypeRequiredDescription
environment_id string yes The environment ID.
workspace_id string no The workspace ID (defaults to the configured workspace).

split_list_workspaces

List all Split workspaces. Returns workspace IDs, names, and the number of environments.

Operation
Read read
Full name
split.split_list_workspaces
ParameterTypeRequiredDescription
No parameters.

split_get_current_user

Get information about the currently authenticated Split user. Useful for verifying API credentials.

Operation
Read read
Full name
split.split_get_current_user
ParameterTypeRequiredDescription
No parameters.