analytics
SpeedCurve Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the SpeedCurve KosmoKrator integration.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.
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
SpeedCurve workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.speedcurve.list_sites({}))' --json kosmo integrations:lua --eval 'print(docs.read("speedcurve"))' --json
kosmo integrations:lua --eval 'print(docs.read("speedcurve.list_sites"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local speedcurve = app.integrations.speedcurve
local result = speedcurve.list_sites({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.speedcurve, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.speedcurve.default.* or app.integrations.speedcurve.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need SpeedCurve, use the narrower 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.
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
| Name | Type | Required | Description |
|---|---|---|---|
site_id | integer | yes | The 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
| 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
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
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
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
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. local result = app.integrations.speedcurve.list_sites({})
print(result) Functions
list_sites Read
List all monitored sites in SpeedCurve. Returns site IDs, names, and URLs that you can use to query test results.
- Lua path
app.integrations.speedcurve.list_sites- Full name
speedcurve.speedcurve_list_sites
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_site Read
Get detailed information about a specific SpeedCurve site, including its URLs, test settings, and latest test results.
- Lua path
app.integrations.speedcurve.get_site- Full name
speedcurve.speedcurve_get_site
| Parameter | Type | Required | Description |
|---|---|---|---|
site_id | integer | yes | The SpeedCurve site ID. |
list_tests Read
List recent synthetic test results from SpeedCurve. Optionally filter by site, browser, or region.
- Lua path
app.integrations.speedcurve.list_tests- Full name
speedcurve.speedcurve_list_tests
| Parameter | Type | Required | Description |
|---|---|---|---|
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. |
get_test Read
Get detailed results for a specific SpeedCurve synthetic test run, including Core Web Vitals, filmstrip data, and waterfall metrics.
- Lua path
app.integrations.speedcurve.get_test- Full name
speedcurve.speedcurve_get_test
| Parameter | Type | Required | Description |
|---|---|---|---|
test_id | integer | yes | The SpeedCurve test ID. |
list_deployments Read
List recent deployments in SpeedCurve and their performance impact. Shows how each deploy affected Core Web Vitals and load times.
- Lua path
app.integrations.speedcurve.list_deployments- Full name
speedcurve.speedcurve_list_deployments
| Parameter | Type | Required | Description |
|---|---|---|---|
site_id | integer | no | Filter deployments by site ID. |
limit | integer | no | Maximum number of deployments to return. |
create_deployment Write
Register a new deployment in SpeedCurve to trigger synthetic performance tests. Use this when deploying code changes to track their performance impact.
- Lua path
app.integrations.speedcurve.create_deployment- Full name
speedcurve.speedcurve_create_deployment
| Parameter | Type | Required | Description |
|---|---|---|---|
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. |
get_current_user Read
Get details about the currently authenticated SpeedCurve user. Useful for verifying API credentials and checking account information.
- Lua path
app.integrations.speedcurve.get_current_user- Full name
speedcurve.speedcurve_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||