KosmoKrator

automation

Phantombuster Lua API for KosmoKrator Agents

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

6 functions 5 read 1 write API key auth

Lua Namespace

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

Phantombuster — Lua API Reference

list_agents

List all Phantombuster agents in your account.

Parameters

None.

Response

Returns an array of agent objects with id, name, status, and other metadata.

Example

local result = app.integrations.phantombuster.list_agents({})

for _, agent in ipairs(result.agents or {}) do
  print(agent.name .. " (id: " .. agent.id .. ") - " .. agent.status)
end

get_agent

Get details for a specific Phantombuster agent.

Parameters

NameTypeRequiredDescription
idstringyesThe agent ID

Example

local result = app.integrations.phantombuster.get_agent({
  id = "1234567890123456789"
})

print("Agent: " .. result.name)
print("Status: " .. result.status)

launch_agent

Launch a Phantombuster agent to start an automation. Returns a container ID you can use to track execution.

Parameters

NameTypeRequiredDescription
idstringyesThe agent ID to launch

Example

local result = app.integrations.phantombuster.launch_agent({
  id = "1234567890123456789"
})

print("Launched! Container ID: " .. result.container.id)

list_containers

List all Phantombuster containers (execution runs). Returns run history with status, timestamps, and agent associations.

Parameters

None.

Example

local result = app.integrations.phantombuster.list_containers({})

for _, container in ipairs(result.containers or {}) do
  print("Container " .. container.id .. " — " .. container.status .. " — " .. container.agentId)
end

get_container

Get details for a specific Phantombuster container (execution run), including status, output, and logs.

Parameters

NameTypeRequiredDescription
idstringyesThe container ID

Example

local result = app.integrations.phantombuster.get_container({
  id = "9876543210987654321"
})

print("Status: " .. result.status)
print("Output: " .. (result.output or "no output yet"))

get_current_user

Get the authenticated Phantombuster user profile, including account info and plan details.

Parameters

None.

Example

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

print("Email: " .. result.email)
print("Plan: " .. result.plan)

Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.phantombuster.work.function_name({})
app.integrations.phantombuster.client.function_name({})

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

Raw agent markdown
# Phantombuster — Lua API Reference

## list_agents

List all Phantombuster agents in your account.

### Parameters

None.

### Response

Returns an array of agent objects with `id`, `name`, `status`, and other metadata.

### Example

```lua
local result = app.integrations.phantombuster.list_agents({})

for _, agent in ipairs(result.agents or {}) do
  print(agent.name .. " (id: " .. agent.id .. ") - " .. agent.status)
end
```

---

## get_agent

Get details for a specific Phantombuster agent.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The agent ID |

### Example

```lua
local result = app.integrations.phantombuster.get_agent({
  id = "1234567890123456789"
})

print("Agent: " .. result.name)
print("Status: " .. result.status)
```

---

## launch_agent

Launch a Phantombuster agent to start an automation. Returns a container ID you can use to track execution.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The agent ID to launch |

### Example

```lua
local result = app.integrations.phantombuster.launch_agent({
  id = "1234567890123456789"
})

print("Launched! Container ID: " .. result.container.id)
```

---

## list_containers

List all Phantombuster containers (execution runs). Returns run history with status, timestamps, and agent associations.

### Parameters

None.

### Example

```lua
local result = app.integrations.phantombuster.list_containers({})

for _, container in ipairs(result.containers or {}) do
  print("Container " .. container.id .. " — " .. container.status .. " — " .. container.agentId)
end
```

---

## get_container

Get details for a specific Phantombuster container (execution run), including status, output, and logs.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `id` | string | yes | The container ID |

### Example

```lua
local result = app.integrations.phantombuster.get_container({
  id = "9876543210987654321"
})

print("Status: " .. result.status)
print("Output: " .. (result.output or "no output yet"))
```

---

## get_current_user

Get the authenticated Phantombuster user profile, including account info and plan details.

### Parameters

None.

### Example

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

print("Email: " .. result.email)
print("Plan: " .. result.plan)
```

---

## Multi-Account Usage

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

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

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

-- Named accounts
app.integrations.phantombuster.work.function_name({})
app.integrations.phantombuster.client.function_name({})
```

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

Metadata-Derived Lua Example

local result = app.integrations.phantombuster.phantombuster_list_agents({})
print(result)

Functions

phantombuster_list_agents

List all Phantombuster agents in your account. Returns agent IDs, names, and status so you can inspect or launch them.

Operation
Read read
Full name
phantombuster.phantombuster_list_agents
ParameterTypeRequiredDescription
No parameters.

phantombuster_get_agent

Get details for a specific Phantombuster agent, including its configuration, last run status, and output.

Operation
Read read
Full name
phantombuster.phantombuster_get_agent
ParameterTypeRequiredDescription
id string yes The agent ID (e.g., "1234567890123456789").

phantombuster_launch_agent

Launch a Phantombuster agent to start an automation. Returns the container ID for tracking execution progress.

Operation
Write write
Full name
phantombuster.phantombuster_launch_agent
ParameterTypeRequiredDescription
id string yes The agent ID to launch (e.g., "1234567890123456789").

phantombuster_list_containers

List all Phantombuster containers (execution runs). Returns container IDs, associated agent IDs, status, and timestamps.

Operation
Read read
Full name
phantombuster.phantombuster_list_containers
ParameterTypeRequiredDescription
No parameters.

phantombuster_get_container

Get details for a specific Phantombuster container (execution run), including its status, output, and logs.

Operation
Read read
Full name
phantombuster.phantombuster_get_container
ParameterTypeRequiredDescription
id string yes The container ID (e.g., "9876543210987654321").

phantombuster_get_current_user

Get the authenticated Phantombuster user profile, including account info and plan details.

Operation
Read read
Full name
phantombuster.phantombuster_get_current_user
ParameterTypeRequiredDescription
No parameters.