KosmoKrator

productivity

Paperspace Lua API for KosmoKrator Agents

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

Lua Namespace

Agents call this integration through app.integrations.paperspace.*. Use lua_read_doc("integrations.paperspace") 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 Paperspace workflow without starting an interactive agent session.

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

Workflow file

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

workflow.lua
local paperspace = app.integrations.paperspace
local result = paperspace.list_machines({})

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.paperspace, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.paperspace.default.* or app.integrations.paperspace.work.* when you configured named credential accounts.

MCP-only Lua

If the script only needs configured MCP servers and does not need Paperspace, 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.

Paperspace — Lua API Reference

list_machines

List all GPU machines in the account.

Parameters

None.

Example

local result = app.integrations.paperspace.list_machines({})

for _, machine in ipairs(result) do
  print(machine.name .. " (" .. machine.state .. ") - " .. machine.machineType)
end

get_machine

Get details for a specific machine.

Parameters

NameTypeRequiredDescription
machine_idstringyesThe machine ID

Example

local result = app.integrations.paperspace.get_machine({ machine_id = "psabc123" })
local m = result
print(m.name .. " - " .. m.os .. " - " .. m.publicIp)

list_notebooks

List all Gradient notebooks in the account.

Parameters

None.

Example

local result = app.integrations.paperspace.list_notebooks({})

for _, notebook in ipairs(result) do
  print(notebook.name .. " (" .. notebook.state .. ")")
end

list_datasets

List all datasets in the account.

Parameters

None.

Example

local result = app.integrations.paperspace.list_datasets({})

for _, dataset in ipairs(result) do
  print(dataset.name .. " - " .. (dataset.size or "unknown size"))
end

list_projects

List all Gradient projects in the account.

Parameters

None.

Example

local result = app.integrations.paperspace.list_projects({})

for _, project in ipairs(result) do
  print(project.name .. " - " .. (project.description or "no description"))
end

list_ssh_keys

List all SSH keys in the account.

Parameters

None.

Example

local result = app.integrations.paperspace.list_ssh_keys({})

for _, key in ipairs(result) do
  print(key.name .. " - " .. key.fingerprint)
end

get_current_user

Get the current authenticated user information.

Parameters

None.

Example

local result = app.integrations.paperspace.get_current_user({})
print("User: " .. result.email .. " (ID: " .. result.id .. ")")

Multi-Account Usage

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

-- Default account (always works)
app.integrations.paperspace.list_machines({})

-- Explicit default (portable across setups)
app.integrations.paperspace.default.list_machines({})

-- Named accounts
app.integrations.paperspace.production.list_machines({})
app.integrations.paperspace.staging.list_machines({})

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

Raw agent markdown
# Paperspace — Lua API Reference

## list_machines

List all GPU machines in the account.

### Parameters

None.

### Example

```lua
local result = app.integrations.paperspace.list_machines({})

for _, machine in ipairs(result) do
  print(machine.name .. " (" .. machine.state .. ") - " .. machine.machineType)
end
```

---

## get_machine

Get details for a specific machine.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `machine_id` | string | yes | The machine ID |

### Example

```lua
local result = app.integrations.paperspace.get_machine({ machine_id = "psabc123" })
local m = result
print(m.name .. " - " .. m.os .. " - " .. m.publicIp)
```

---

## list_notebooks

List all Gradient notebooks in the account.

### Parameters

None.

### Example

```lua
local result = app.integrations.paperspace.list_notebooks({})

for _, notebook in ipairs(result) do
  print(notebook.name .. " (" .. notebook.state .. ")")
end
```

---

## list_datasets

List all datasets in the account.

### Parameters

None.

### Example

```lua
local result = app.integrations.paperspace.list_datasets({})

for _, dataset in ipairs(result) do
  print(dataset.name .. " - " .. (dataset.size or "unknown size"))
end
```

---

## list_projects

List all Gradient projects in the account.

### Parameters

None.

### Example

```lua
local result = app.integrations.paperspace.list_projects({})

for _, project in ipairs(result) do
  print(project.name .. " - " .. (project.description or "no description"))
end
```

---

## list_ssh_keys

List all SSH keys in the account.

### Parameters

None.

### Example

```lua
local result = app.integrations.paperspace.list_ssh_keys({})

for _, key in ipairs(result) do
  print(key.name .. " - " .. key.fingerprint)
end
```

---

## get_current_user

Get the current authenticated user information.

### Parameters

None.

### Example

```lua
local result = app.integrations.paperspace.get_current_user({})
print("User: " .. result.email .. " (ID: " .. result.id .. ")")
```

---

## Multi-Account Usage

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

```lua
-- Default account (always works)
app.integrations.paperspace.list_machines({})

-- Explicit default (portable across setups)
app.integrations.paperspace.default.list_machines({})

-- Named accounts
app.integrations.paperspace.production.list_machines({})
app.integrations.paperspace.staging.list_machines({})
```

All functions are identical across accounts — only the credentials differ.
Metadata-derived Lua example
local result = app.integrations.paperspace.list_machines({})
print(result)

Functions

list_machines Read

List all GPU machines in the Paperspace account. Returns IDs, names, OS, machine type, state, and public IP address.

Lua path
app.integrations.paperspace.list_machines
Full name
paperspace.paperspace_list_machines
ParameterTypeRequiredDescription
No parameters.
get_machine Read

Get details for a specific Paperspace machine by ID. Returns full machine information including specs, state, and network configuration.

Lua path
app.integrations.paperspace.get_machine
Full name
paperspace.paperspace_get_machine
ParameterTypeRequiredDescription
machine_id string yes The machine ID.
list_notebooks Read

List all Gradient notebooks in the Paperspace account. Returns notebook IDs, names, cluster, machine type, and state.

Lua path
app.integrations.paperspace.list_notebooks
Full name
paperspace.paperspace_list_notebooks
ParameterTypeRequiredDescription
No parameters.
list_datasets Read

List all datasets in the Paperspace account. Returns dataset IDs, names, storage usage, and creation dates.

Lua path
app.integrations.paperspace.list_datasets
Full name
paperspace.paperspace_list_datasets
ParameterTypeRequiredDescription
No parameters.
list_projects Read

List all Gradient projects in the Paperspace account. Returns project IDs, names, descriptions, and creation dates.

Lua path
app.integrations.paperspace.list_projects
Full name
paperspace.paperspace_list_projects
ParameterTypeRequiredDescription
No parameters.
list_ssh_keys Read

List all SSH keys in the Paperspace account. Returns key IDs, names, and fingerprints.

Lua path
app.integrations.paperspace.list_ssh_keys
Full name
paperspace.paperspace_list_ssh_keys
ParameterTypeRequiredDescription
No parameters.
get_current_user Read

Get information about the current authenticated Paperspace user, including email, user ID, and team membership.

Lua path
app.integrations.paperspace.get_current_user
Full name
paperspace.paperspace_get_current_user
ParameterTypeRequiredDescription
No parameters.