KosmoKrator

communication

Agora Lua API for KosmoKrator Agents

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

7 functions 5 read 2 write API key auth

Lua Namespace

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

Agora — Lua API Reference

list_projects

List all Agora projects.

Parameters

NameTypeRequiredDescription
No parameters required

Example

local result = app.integrations["agora"].list_projects({})

for _, project in ipairs(result.data) do
  print(project.id .. ": " .. project.name .. " (" .. project.status .. ")")
end

get_project

Get details of a specific project by ID.

Parameters

NameTypeRequiredDescription
project_idstringyesThe project ID

Example

local result = app.integrations["agora"].get_project({
  project_id = "abc123"
})

print("Project: " .. result.name)
print("App ID: " .. result.app_id)
print("Status: " .. result.status)

create_project

Create a new Agora project.

Parameters

NameTypeRequiredDescription
namestringyesA unique name for the project
recording_configobjectnoRecording configuration (e.g., max_idle_time, stream_types)
sign_keybooleannoWhether to enable a signaling key (default: false)

Example

local result = app.integrations["agora"].create_project({
  name = "my-video-app",
  sign_key = true
})

print("Created project: " .. result.name)
print("App ID: " .. result.app_id)

list_recordings

List cloud recordings with optional filters.

Parameters

NameTypeRequiredDescription
cnamestringnoFilter by channel name
resource_idstringnoFilter by resource ID
limitintegernoMaximum results (default: 20)
start_tsintegernoUnix timestamp to filter recordings starting after this time
end_tsintegernoUnix timestamp to filter recordings ending before this time

Example

local result = app.integrations["agora"].list_recordings({
  cname = "meeting-room",
  limit = 10
})

for _, rec in ipairs(result.data) do
  print(rec.sid .. ": " .. rec.cname .. " (" .. rec.status .. ")")
end

get_recording

Get details of a specific recording by session ID.

Parameters

NameTypeRequiredDescription
recording_idstringyesThe recording session ID (sid)

Example

local result = app.integrations["agora"].get_recording({
  recording_id = "sid-abc123"
})

print("SID: " .. result.sid)
print("Channel: " .. result.cname)
print("Status: " .. result.status)
if result.file_list then
  for _, file in ipairs(result.file_list) do
    print("  File: " .. file.filename .. " -> " .. file.download_url)
  end
end

start_recording

Start a cloud recording for a channel.

Parameters

NameTypeRequiredDescription
cnamestringyesThe channel name to record
uidstringyesUser ID of the recording client in the channel
clientRequestobjectnoRecording and storage configuration

clientRequest Syntax

clientRequest = {
  recordingConfig = {
    maxIdleTime = 30,
    streamTypes = 2,
    channelType = 0
  },
  storageConfig = {
    vendor = 1,
    region = 0,
    bucket = "my-bucket",
    accessKey = "...",
    secretKey = "...",
    fileNamePrefix = { "recording" }
  }
}

Example

local result = app.integrations["agora"].start_recording({
  cname = "meeting-room",
  uid = "527841",
  clientRequest = {
    recordingConfig = {
      maxIdleTime = 30,
      streamTypes = 2
    },
    storageConfig = {
      vendor = 1,
      region = 0,
      bucket = "my-recordings",
      accessKey = "AKIA...",
      secretKey = "secret...",
      fileNamePrefix = { "agora", "rec" }
    }
  }
})

print("Recording started: " .. result.sid)
print("Resource ID: " .. result.resourceId)

get_current_user

Get information about the current authenticated Agora user.

Parameters

NameTypeRequiredDescription
No parameters required

Example

local result = app.integrations["agora"].get_current_user({})

print("User: " .. result.user.name)
print("Email: " .. result.user.email)

Multi-Account Usage

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

-- Default account (always works)
app.integrations["agora"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["agora"].default.function_name({...})

-- Named accounts
app.integrations["agora"].production.function_name({...})
app.integrations["agora"].staging.function_name({...})

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

Raw agent markdown
# Agora — Lua API Reference

## list_projects

List all Agora projects.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| — | — | — | No parameters required |

### Example

```lua
local result = app.integrations["agora"].list_projects({})

for _, project in ipairs(result.data) do
  print(project.id .. ": " .. project.name .. " (" .. project.status .. ")")
end
```

---

## get_project

Get details of a specific project by ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `project_id` | string | yes | The project ID |

### Example

```lua
local result = app.integrations["agora"].get_project({
  project_id = "abc123"
})

print("Project: " .. result.name)
print("App ID: " .. result.app_id)
print("Status: " .. result.status)
```

---

## create_project

Create a new Agora project.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `name` | string | yes | A unique name for the project |
| `recording_config` | object | no | Recording configuration (e.g., max_idle_time, stream_types) |
| `sign_key` | boolean | no | Whether to enable a signaling key (default: false) |

### Example

```lua
local result = app.integrations["agora"].create_project({
  name = "my-video-app",
  sign_key = true
})

print("Created project: " .. result.name)
print("App ID: " .. result.app_id)
```

---

## list_recordings

List cloud recordings with optional filters.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `cname` | string | no | Filter by channel name |
| `resource_id` | string | no | Filter by resource ID |
| `limit` | integer | no | Maximum results (default: 20) |
| `start_ts` | integer | no | Unix timestamp to filter recordings starting after this time |
| `end_ts` | integer | no | Unix timestamp to filter recordings ending before this time |

### Example

```lua
local result = app.integrations["agora"].list_recordings({
  cname = "meeting-room",
  limit = 10
})

for _, rec in ipairs(result.data) do
  print(rec.sid .. ": " .. rec.cname .. " (" .. rec.status .. ")")
end
```

---

## get_recording

Get details of a specific recording by session ID.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `recording_id` | string | yes | The recording session ID (sid) |

### Example

```lua
local result = app.integrations["agora"].get_recording({
  recording_id = "sid-abc123"
})

print("SID: " .. result.sid)
print("Channel: " .. result.cname)
print("Status: " .. result.status)
if result.file_list then
  for _, file in ipairs(result.file_list) do
    print("  File: " .. file.filename .. " -> " .. file.download_url)
  end
end
```

---

## start_recording

Start a cloud recording for a channel.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `cname` | string | yes | The channel name to record |
| `uid` | string | yes | User ID of the recording client in the channel |
| `clientRequest` | object | no | Recording and storage configuration |

### clientRequest Syntax

```lua
clientRequest = {
  recordingConfig = {
    maxIdleTime = 30,
    streamTypes = 2,
    channelType = 0
  },
  storageConfig = {
    vendor = 1,
    region = 0,
    bucket = "my-bucket",
    accessKey = "...",
    secretKey = "...",
    fileNamePrefix = { "recording" }
  }
}
```

### Example

```lua
local result = app.integrations["agora"].start_recording({
  cname = "meeting-room",
  uid = "527841",
  clientRequest = {
    recordingConfig = {
      maxIdleTime = 30,
      streamTypes = 2
    },
    storageConfig = {
      vendor = 1,
      region = 0,
      bucket = "my-recordings",
      accessKey = "AKIA...",
      secretKey = "secret...",
      fileNamePrefix = { "agora", "rec" }
    }
  }
})

print("Recording started: " .. result.sid)
print("Resource ID: " .. result.resourceId)
```

---

## get_current_user

Get information about the current authenticated Agora user.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| — | — | — | No parameters required |

### Example

```lua
local result = app.integrations["agora"].get_current_user({})

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

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations["agora"].function_name({...})

-- Explicit default (portable across setups)
app.integrations["agora"].default.function_name({...})

-- Named accounts
app.integrations["agora"].production.function_name({...})
app.integrations["agora"].staging.function_name({...})
```

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

Metadata-Derived Lua Example

local result = app.integrations.agora.agora_list_projects({})
print(result)

Functions

agora_list_projects

List all Agora projects. Returns project IDs, names, and their current status.

Operation
Read read
Full name
agora.agora_list_projects
ParameterTypeRequiredDescription
No parameters.

agora_get_project

Get details of a specific Agora project by ID, including its name, App ID, App Certificate, and status.

Operation
Read read
Full name
agora.agora_get_project
ParameterTypeRequiredDescription
project_id string yes The project ID.

agora_create_project

Create a new Agora project. Specify a project name and optional configuration such as recording settings and authentication mode.

Operation
Write write
Full name
agora.agora_create_project
ParameterTypeRequiredDescription
name string yes A unique name for the project.
recording_config object no Recording configuration as a JSON object (e.g., {"max_idle_time": 30, "stream_types": 2}).
sign_key boolean no Whether to enable a signaling key for the project (default: false).

agora_list_recordings

List cloud recordings from Agora with optional filters. Supports filtering by channel name, resource ID, and time range.

Operation
Read read
Full name
agora.agora_list_recordings
ParameterTypeRequiredDescription
cname string no Filter recordings by channel name.
resource_id string no Filter by resource ID.
limit integer no Maximum number of recordings to return (default: 20).
start_ts integer no Unix timestamp to filter recordings starting after this time.
end_ts integer no Unix timestamp to filter recordings ending before this time.

agora_get_recording

Get details of a specific Agora cloud recording by its session ID (sid), including status, file list, and download URLs.

Operation
Read read
Full name
agora.agora_get_recording
ParameterTypeRequiredDescription
recording_id string yes The recording session ID (sid).

agora_start_recording

Start a cloud recording for an Agora channel. Specify the channel name, UID, and recording configuration such as container format, storage settings, and layout.

Operation
Write write
Full name
agora.agora_start_recording
ParameterTypeRequiredDescription
cname string yes The channel name to record.
uid string yes The user ID of the recording client in the channel.
clientRequest object no Recording configuration including recordingConfig and storageConfig (e.g., {"recordingConfig": {"maxIdleTime": 30, "streamTypes": 2}, "storageConfig": {"vendor": 1, "region": 0, "bucket": "my-bucket", "accessKey": "...", "secretKey": "...", "fileNamePrefix": ["recording"]}}).

agora_get_current_user

Get information about the current authenticated Agora user.

Operation
Read read
Full name
agora.agora_get_current_user
ParameterTypeRequiredDescription
No parameters.