analytics
New Relic Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the New Relic KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.newrelic.*.
Use lua_read_doc("integrations.newrelic") 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
New Relic workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.newrelic.list_applications({}))' --json kosmo integrations:lua --eval 'print(docs.read("newrelic"))' --json
kosmo integrations:lua --eval 'print(docs.read("newrelic.list_applications"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local newrelic = app.integrations.newrelic
local result = newrelic.list_applications({})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.newrelic, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.newrelic.default.* or app.integrations.newrelic.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need New Relic, 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.
New Relic — Lua API Reference
list_applications
List APM applications in the configured New Relic account.
Parameters
None.
Example
local result = app.integrations.newrelic.list_applications({})
for _, app in ipairs(result) do
print(app.name .. " (" .. app.applicationId .. ") - " .. app.healthStatus)
end
get_application
Get details of a specific APM application by its application ID.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
application_id | integer | yes | The New Relic application ID |
Example
local result = app.integrations.newrelic.get_application({
application_id = 12345678
})
print("Name: " .. result.name)
print("Language: " .. result.language)
print("Health: " .. result.healthStatus)
list_deployments
List deployment markers for a New Relic APM application.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
application_guid | string | yes | The entity GUID of the application |
Example
local result = app.integrations.newrelic.list_deployments({
application_guid = "MxJ9MxNNTU2NjIxFExWFxBfEFBVXxBYU"
})
for _, dep in ipairs(result) do
print(dep.revision .. " by " .. dep.user .. " at " .. dep.timestamp)
end
create_deployment
Record a new deployment marker in New Relic.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
application_guid | string | yes | The entity GUID of the application |
revision | string | yes | Deployment revision (e.g. commit SHA, version) |
description | string | no | Description of the deployment |
user | string | no | User who triggered the deployment |
changelog | string | no | Changelog or commit message |
Example
local result = app.integrations.newrelic.create_deployment({
application_guid = "MxJ9MxNNTU2NjIxFExWFxBfEFBVXxBYU",
revision = "abc123def456",
description = "Release v2.5.0",
user = "deploy-bot",
changelog = "feat: add user dashboard"
})
print("Deployment created: " .. result.guid)
list_alert_policies
List alert policies in the configured New Relic account.
Parameters
None.
Example
local result = app.integrations.newrelic.list_alert_policies({})
for _, policy in ipairs(result) do
print(policy.name .. " (ID: " .. policy.id .. ")")
end
list_dashboards
List dashboards in the configured New Relic account.
Parameters
None.
Example
local result = app.integrations.newrelic.list_dashboards({})
for _, dash in ipairs(result) do
print(dash.title .. " - owner: " .. (dash.owner.email or "unknown"))
end
get_current_user
Get the profile of the currently authenticated New Relic user.
Parameters
None.
Example
local result = app.integrations.newrelic.get_current_user({})
print("User: " .. result.actor.user.name)
print("Email: " .. result.actor.user.email)
Multi-Account Usage
If you have multiple New Relic accounts configured, use account-specific namespaces:
-- Default account (always works)
app.integrations.newrelic.function_name({...})
-- Explicit default (portable across setups)
app.integrations.newrelic.default.function_name({...})
-- Named accounts
app.integrations.newrelic.production.function_name({...})
app.integrations.newrelic.staging.function_name({...})
All functions are identical across accounts — only the credentials differ.
Raw agent markdown
# New Relic — Lua API Reference
## list_applications
List APM applications in the configured New Relic account.
### Parameters
None.
### Example
```lua
local result = app.integrations.newrelic.list_applications({})
for _, app in ipairs(result) do
print(app.name .. " (" .. app.applicationId .. ") - " .. app.healthStatus)
end
```
---
## get_application
Get details of a specific APM application by its application ID.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `application_id` | integer | yes | The New Relic application ID |
### Example
```lua
local result = app.integrations.newrelic.get_application({
application_id = 12345678
})
print("Name: " .. result.name)
print("Language: " .. result.language)
print("Health: " .. result.healthStatus)
```
---
## list_deployments
List deployment markers for a New Relic APM application.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `application_guid` | string | yes | The entity GUID of the application |
### Example
```lua
local result = app.integrations.newrelic.list_deployments({
application_guid = "MxJ9MxNNTU2NjIxFExWFxBfEFBVXxBYU"
})
for _, dep in ipairs(result) do
print(dep.revision .. " by " .. dep.user .. " at " .. dep.timestamp)
end
```
---
## create_deployment
Record a new deployment marker in New Relic.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `application_guid` | string | yes | The entity GUID of the application |
| `revision` | string | yes | Deployment revision (e.g. commit SHA, version) |
| `description` | string | no | Description of the deployment |
| `user` | string | no | User who triggered the deployment |
| `changelog` | string | no | Changelog or commit message |
### Example
```lua
local result = app.integrations.newrelic.create_deployment({
application_guid = "MxJ9MxNNTU2NjIxFExWFxBfEFBVXxBYU",
revision = "abc123def456",
description = "Release v2.5.0",
user = "deploy-bot",
changelog = "feat: add user dashboard"
})
print("Deployment created: " .. result.guid)
```
---
## list_alert_policies
List alert policies in the configured New Relic account.
### Parameters
None.
### Example
```lua
local result = app.integrations.newrelic.list_alert_policies({})
for _, policy in ipairs(result) do
print(policy.name .. " (ID: " .. policy.id .. ")")
end
```
---
## list_dashboards
List dashboards in the configured New Relic account.
### Parameters
None.
### Example
```lua
local result = app.integrations.newrelic.list_dashboards({})
for _, dash in ipairs(result) do
print(dash.title .. " - owner: " .. (dash.owner.email or "unknown"))
end
```
---
## get_current_user
Get the profile of the currently authenticated New Relic user.
### Parameters
None.
### Example
```lua
local result = app.integrations.newrelic.get_current_user({})
print("User: " .. result.actor.user.name)
print("Email: " .. result.actor.user.email)
```
---
## Multi-Account Usage
If you have multiple New Relic accounts configured, use account-specific namespaces:
```lua
-- Default account (always works)
app.integrations.newrelic.function_name({...})
-- Explicit default (portable across setups)
app.integrations.newrelic.default.function_name({...})
-- Named accounts
app.integrations.newrelic.production.function_name({...})
app.integrations.newrelic.staging.function_name({...})
```
All functions are identical across accounts — only the credentials differ. local result = app.integrations.newrelic.list_applications({})
print(result) Functions
list_applications Read
List APM applications in the configured New Relic account. Returns application names, GUIDs, IDs, language, reporting status, and health status.
- Lua path
app.integrations.newrelic.list_applications- Full name
newrelic.newrelic_list_applications
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_application Read
Get details of a specific New Relic APM application by its application ID, including language, health status, and Apdex thresholds.
- Lua path
app.integrations.newrelic.get_application- Full name
newrelic.newrelic_get_application
| Parameter | Type | Required | Description |
|---|---|---|---|
application_id | integer | yes | The New Relic application ID. |
list_deployments Read
List deployment markers for a New Relic APM application. Requires the application entity GUID.
- Lua path
app.integrations.newrelic.list_deployments- Full name
newrelic.newrelic_list_deployments
| Parameter | Type | Required | Description |
|---|---|---|---|
application_guid | string | yes | The entity GUID of the New Relic application. |
create_deployment Write
Record a new deployment marker in New Relic for a given application. This helps correlate deploys with performance changes.
- Lua path
app.integrations.newrelic.create_deployment- Full name
newrelic.newrelic_create_deployment
| Parameter | Type | Required | Description |
|---|---|---|---|
application_guid | string | yes | The entity GUID of the New Relic application. |
revision | string | yes | The deployment revision (e.g. commit SHA, version number). |
description | string | no | A description of the deployment. |
user | string | no | The user who triggered the deployment. |
changelog | string | no | Changelog or commit message for the deployment. |
list_alert_policies Read
List alert policies in the configured New Relic account. Returns policy names, IDs, and incident preferences.
- Lua path
app.integrations.newrelic.list_alert_policies- Full name
newrelic.newrelic_list_alert_policies
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
list_dashboards Read
List dashboards in the configured New Relic account. Returns dashboard titles, GUIDs, timestamps, and owner information.
- Lua path
app.integrations.newrelic.list_dashboards- Full name
newrelic.newrelic_list_dashboards
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||
get_current_user Read
Get the profile of the currently authenticated New Relic user. Useful for verifying API credentials and retrieving account information.
- Lua path
app.integrations.newrelic.get_current_user- Full name
newrelic.newrelic_get_current_user
| Parameter | Type | Required | Description |
|---|---|---|---|
| No parameters. | |||