KosmoKrator

analytics

SpeedCurve Lua API for KosmoKrator Agents

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

7 functions 6 read 1 write API key auth

Lua Namespace

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

SpeedCurve — Lua API Reference

list_sites

List all monitored sites in SpeedCurve.

Parameters

None.

Example

local result = app.integrations.speedcurve.list_sites({})

for _, site in ipairs(result.sites) do
  print(site.site_id .. ": " .. site.name)
end

get_site

Get detailed information about a specific SpeedCurve site.

Parameters

NameTypeRequiredDescription
site_idintegeryesThe SpeedCurve site ID

Example

local result = app.integrations.speedcurve.get_site({
  site_id = 12345
})

print("Site: " .. result.site.name)
for _, url in ipairs(result.urls or {}) do
  print("  URL: " .. url.url)
end

list_tests

List recent synthetic test results. Optionally filter by site, browser, or region.

Parameters

NameTypeRequiredDescription
site_idintegernoFilter by site ID
url_idintegernoFilter by URL ID
browserstringnoFilter by browser (e.g., "Chrome", "Firefox")
regionstringnoFilter by region (e.g., "us-east-1", "eu-west-1")
daysintegernoNumber of days of test history to return

Example

local result = app.integrations.speedcurve.list_tests({
  site_id = 12345,
  days = 7
})

for _, test in ipairs(result.tests or {}) do
  print("Test " .. test.test_id .. " — LCP: " .. (test.largest_contentful_paint or "N/A"))
end

get_test

Get detailed results for a specific synthetic test run.

Parameters

NameTypeRequiredDescription
test_idintegeryesThe SpeedCurve test ID

Example

local result = app.integrations.speedcurve.get_test({
  test_id = 67890
})

print("URL: " .. result.url)
print("LCP: " .. (result.largest_contentful_paint or "N/A"))
print("FID: " .. (result.first_input_delay or "N/A"))
print("CLS: " .. (result.cumulative_layout_shift or "N/A"))

list_deployments

List recent deployments and their performance impact.

Parameters

NameTypeRequiredDescription
site_idintegernoFilter by site ID
limitintegernoMaximum number of deployments to return

Example

local result = app.integrations.speedcurve.list_deployments({
  site_id = 12345,
  limit = 10
})

for _, deploy in ipairs(result.deployments or {}) do
  print(deploy.deploy_id .. ": " .. (deploy.note or "No note") .. " — " .. deploy.status)
end

create_deployment

Register a new deployment to trigger synthetic tests.

Parameters

NameTypeRequiredDescription
site_idintegeryesThe SpeedCurve site ID to deploy to
notestringnoDescription of the deployment (e.g., "Deploy v2.3.1")
detailstringnoAdditional details (e.g., git commit SHA or changelog URL)

Example

local result = app.integrations.speedcurve.create_deployment({
  site_id = 12345,
  note = "Deploy v2.3.1 — new checkout flow",
  detail = "commit: abc123def"
})

print("Deployment created: " .. result.deploy_id)

get_current_user

Get details about the authenticated SpeedCurve user. Useful for verifying credentials.

Parameters

None.

Example

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

print("User: " .. result.name)
print("Email: " .. result.email)
print("Account: " .. (result.account or "N/A"))

Multi-Account Usage

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

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

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

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

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

Raw agent markdown
# SpeedCurve — Lua API Reference

## list_sites

List all monitored sites in SpeedCurve.

### Parameters

None.

### Example

```lua
local result = app.integrations.speedcurve.list_sites({})

for _, site in ipairs(result.sites) do
  print(site.site_id .. ": " .. site.name)
end
```

---

## get_site

Get detailed information about a specific SpeedCurve site.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `site_id` | integer | yes | The SpeedCurve site ID |

### Example

```lua
local result = app.integrations.speedcurve.get_site({
  site_id = 12345
})

print("Site: " .. result.site.name)
for _, url in ipairs(result.urls or {}) do
  print("  URL: " .. url.url)
end
```

---

## list_tests

List recent synthetic test results. Optionally filter by site, browser, or region.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `site_id` | integer | no | Filter by site ID |
| `url_id` | integer | no | Filter by URL ID |
| `browser` | string | no | Filter by browser (e.g., `"Chrome"`, `"Firefox"`) |
| `region` | string | no | Filter by region (e.g., `"us-east-1"`, `"eu-west-1"`) |
| `days` | integer | no | Number of days of test history to return |

### Example

```lua
local result = app.integrations.speedcurve.list_tests({
  site_id = 12345,
  days = 7
})

for _, test in ipairs(result.tests or {}) do
  print("Test " .. test.test_id .. " — LCP: " .. (test.largest_contentful_paint or "N/A"))
end
```

---

## get_test

Get detailed results for a specific synthetic test run.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `test_id` | integer | yes | The SpeedCurve test ID |

### Example

```lua
local result = app.integrations.speedcurve.get_test({
  test_id = 67890
})

print("URL: " .. result.url)
print("LCP: " .. (result.largest_contentful_paint or "N/A"))
print("FID: " .. (result.first_input_delay or "N/A"))
print("CLS: " .. (result.cumulative_layout_shift or "N/A"))
```

---

## list_deployments

List recent deployments and their performance impact.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `site_id` | integer | no | Filter by site ID |
| `limit` | integer | no | Maximum number of deployments to return |

### Example

```lua
local result = app.integrations.speedcurve.list_deployments({
  site_id = 12345,
  limit = 10
})

for _, deploy in ipairs(result.deployments or {}) do
  print(deploy.deploy_id .. ": " .. (deploy.note or "No note") .. " — " .. deploy.status)
end
```

---

## create_deployment

Register a new deployment to trigger synthetic tests.

### Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `site_id` | integer | yes | The SpeedCurve site ID to deploy to |
| `note` | string | no | Description of the deployment (e.g., `"Deploy v2.3.1"`) |
| `detail` | string | no | Additional details (e.g., git commit SHA or changelog URL) |

### Example

```lua
local result = app.integrations.speedcurve.create_deployment({
  site_id = 12345,
  note = "Deploy v2.3.1 — new checkout flow",
  detail = "commit: abc123def"
})

print("Deployment created: " .. result.deploy_id)
```

---

## get_current_user

Get details about the authenticated SpeedCurve user. Useful for verifying credentials.

### Parameters

None.

### Example

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

print("User: " .. result.name)
print("Email: " .. result.email)
print("Account: " .. (result.account or "N/A"))
```

---

## Multi-Account Usage

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

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

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

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

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

Metadata-Derived Lua Example

local result = app.integrations.speedcurve.speedcurve_list_sites({})
print(result)

Functions

speedcurve_list_sites

List all monitored sites in SpeedCurve. Returns site IDs, names, and URLs that you can use to query test results.

Operation
Read read
Full name
speedcurve.speedcurve_list_sites
ParameterTypeRequiredDescription
No parameters.

speedcurve_get_site

Get detailed information about a specific SpeedCurve site, including its URLs, test settings, and latest test results.

Operation
Read read
Full name
speedcurve.speedcurve_get_site
ParameterTypeRequiredDescription
site_id integer yes The SpeedCurve site ID.

speedcurve_list_tests

List recent synthetic test results from SpeedCurve. Optionally filter by site, browser, or region.

Operation
Read read
Full name
speedcurve.speedcurve_list_tests
ParameterTypeRequiredDescription
site_id integer no Filter tests by site ID.
url_id integer no Filter tests by URL ID.
browser string no Filter by browser (e.g., "Chrome", "Firefox").
region string no Filter by region (e.g., "us-east-1", "eu-west-1").
days integer no Number of days of test history to return.

speedcurve_get_test

Get detailed results for a specific SpeedCurve synthetic test run, including Core Web Vitals, filmstrip data, and waterfall metrics.

Operation
Read read
Full name
speedcurve.speedcurve_get_test
ParameterTypeRequiredDescription
test_id integer yes The SpeedCurve test ID.

speedcurve_list_deployments

List recent deployments in SpeedCurve and their performance impact. Shows how each deploy affected Core Web Vitals and load times.

Operation
Read read
Full name
speedcurve.speedcurve_list_deployments
ParameterTypeRequiredDescription
site_id integer no Filter deployments by site ID.
limit integer no Maximum number of deployments to return.

speedcurve_create_deployment

Register a new deployment in SpeedCurve to trigger synthetic performance tests. Use this when deploying code changes to track their performance impact.

Operation
Write write
Full name
speedcurve.speedcurve_create_deployment
ParameterTypeRequiredDescription
site_id integer yes The SpeedCurve site ID to deploy to.
note string no A description or note for this deployment (e.g., "Deploy v2.3.1 — new checkout flow").
detail string no Additional details about the deployment, such as a git commit SHA or changelog URL.

speedcurve_get_current_user

Get details about the currently authenticated SpeedCurve user. Useful for verifying API credentials and checking account information.

Operation
Read read
Full name
speedcurve.speedcurve_get_current_user
ParameterTypeRequiredDescription
No parameters.