KosmoKrator

productivity

Bugsnag Lua API for KosmoKrator Agents

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

Lua Namespace

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

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

Workflow file

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

workflow.lua
local bugsnag = app.integrations.bugsnag
local result = bugsnag.api_get({})

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

MCP-only Lua

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

Bugsnag Integration

Namespace: app.integrations.bugsnag

Use this integration to access Bugsnag error-monitoring data, inspect projects and releases, manage error workflow data, report builds and sessions, and create privacy export requests.

Common Workflows

Find Organizations And Projects

local orgs = app.integrations.bugsnag.list_organizations({})

local projects = app.integrations.bugsnag.list_organization_projects({
  organization_id = "org_id"
})

Most Data Access API endpoints use Bugsnag IDs from these responses.

List And Filter Errors

local errors = app.integrations.bugsnag.list_errors({
  project_id = "project_id",
  query = {
    ["filters[error.status][][value]"] = "open",
    ["filters[error.status][][type]"] = "eq"
  }
})

Bugsnag exposes many filters using bracketed query parameter names. Put those filters in the query object so the integration sends them unchanged.

local trend = app.integrations.bugsnag.get_project_trend({
  project_id = "project_id",
  resolution = "30m",
  query = {
    ["filters[event.since][][value]"] = "1d",
    ["filters[event.since][][type]"] = "eq"
  }
})

local users = app.integrations.bugsnag.list_pivot_values({
  project_id = "project_id",
  error_id = "error_id",
  pivot = "user.id"
})

Create Privacy Event Data Requests

local request = app.integrations.bugsnag.create_organization_event_data_request({
  organization_id = "org_id",
  query = {
    report_type = "gdpr",
    ["filters[user.id][][value]"] = "user_123",
    ["filters[user.id][][type]"] = "eq"
  }
})

Poll get_organization_event_data_request or get_project_event_data_request until Bugsnag returns a completed request URL.

Build And Session Reporting

local build = app.integrations.bugsnag.notify_build({
  payload = {
    apiKey = "project_api_key",
    appVersion = "1.2.3",
    releaseStage = "production"
  }
})

local session = app.integrations.bugsnag.report_session({
  payload = {
    apiKey = "project_api_key",
    notifier = { name = "custom-agent", version = "1.0.0", url = "https://example.test" },
    sessions = {}
  }
})

The build, session, and error-reporting APIs use project API keys in their payloads. The configured integration token is still used for this package’s HTTP client.

Coverage Notes

Focused tools cover authenticated user lookup, organizations, organization projects, collaborators, teams, projects, errors, events, trends, pivots, releases, GDPR and CCPA event data requests, error reporting, build reporting, session reporting, and raw Data Access API escape hatches.

The Bugsnag Data Access API v2 requires the X-Version: 2 header. The integration sends it automatically for Data Access API tools.

Raw agent markdown
# Bugsnag Integration

Namespace: `app.integrations.bugsnag`

Use this integration to access Bugsnag error-monitoring data, inspect projects and releases, manage error workflow data, report builds and sessions, and create privacy export requests.

## Common Workflows

### Find Organizations And Projects

```lua
local orgs = app.integrations.bugsnag.list_organizations({})

local projects = app.integrations.bugsnag.list_organization_projects({
  organization_id = "org_id"
})
```

Most Data Access API endpoints use Bugsnag IDs from these responses.

### List And Filter Errors

```lua
local errors = app.integrations.bugsnag.list_errors({
  project_id = "project_id",
  query = {
    ["filters[error.status][][value]"] = "open",
    ["filters[error.status][][type]"] = "eq"
  }
})
```

Bugsnag exposes many filters using bracketed query parameter names. Put those filters in the `query` object so the integration sends them unchanged.

### Inspect Trends And Pivots

```lua
local trend = app.integrations.bugsnag.get_project_trend({
  project_id = "project_id",
  resolution = "30m",
  query = {
    ["filters[event.since][][value]"] = "1d",
    ["filters[event.since][][type]"] = "eq"
  }
})

local users = app.integrations.bugsnag.list_pivot_values({
  project_id = "project_id",
  error_id = "error_id",
  pivot = "user.id"
})
```

### Create Privacy Event Data Requests

```lua
local request = app.integrations.bugsnag.create_organization_event_data_request({
  organization_id = "org_id",
  query = {
    report_type = "gdpr",
    ["filters[user.id][][value]"] = "user_123",
    ["filters[user.id][][type]"] = "eq"
  }
})
```

Poll `get_organization_event_data_request` or `get_project_event_data_request` until Bugsnag returns a completed request URL.

### Build And Session Reporting

```lua
local build = app.integrations.bugsnag.notify_build({
  payload = {
    apiKey = "project_api_key",
    appVersion = "1.2.3",
    releaseStage = "production"
  }
})

local session = app.integrations.bugsnag.report_session({
  payload = {
    apiKey = "project_api_key",
    notifier = { name = "custom-agent", version = "1.0.0", url = "https://example.test" },
    sessions = {}
  }
})
```

The build, session, and error-reporting APIs use project API keys in their payloads. The configured integration token is still used for this package's HTTP client.

## Coverage Notes

Focused tools cover authenticated user lookup, organizations, organization projects, collaborators, teams, projects, errors, events, trends, pivots, releases, GDPR and CCPA event data requests, error reporting, build reporting, session reporting, and raw Data Access API escape hatches.

The Bugsnag Data Access API v2 requires the `X-Version: 2` header. The integration sends it automatically for Data Access API tools.
Metadata-derived Lua example
local result = app.integrations.bugsnag.api_get({})
print(result)

Functions

api_get Read

Call any Bugsnag Data Access API GET endpoint with query parameters.

Lua path
app.integrations.bugsnag.api_get
Full name
bugsnag.bugsnag_api_get
ParameterTypeRequiredDescription
No parameters.
api_post Write

Call any Bugsnag Data Access API POST endpoint with a JSON payload.

Lua path
app.integrations.bugsnag.api_post
Full name
bugsnag.bugsnag_api_post
ParameterTypeRequiredDescription
No parameters.
api_patch Write

Call any Bugsnag Data Access API PATCH endpoint with a JSON payload.

Lua path
app.integrations.bugsnag.api_patch
Full name
bugsnag.bugsnag_api_patch
ParameterTypeRequiredDescription
No parameters.
api_delete Write

Call any Bugsnag Data Access API DELETE endpoint with query parameters.

Lua path
app.integrations.bugsnag.api_delete
Full name
bugsnag.bugsnag_api_delete
ParameterTypeRequiredDescription
No parameters.
get_current_user Read

Get the currently authenticated Bugsnag user.

Lua path
app.integrations.bugsnag.get_current_user
Full name
bugsnag.bugsnag_get_current_user
ParameterTypeRequiredDescription
No parameters.
list_organizations Read

List Bugsnag organizations for the authenticated user.

Lua path
app.integrations.bugsnag.list_organizations
Full name
bugsnag.bugsnag_list_organizations
ParameterTypeRequiredDescription
No parameters.
list_organization_projects Read

List projects for a Bugsnag organization.

Lua path
app.integrations.bugsnag.list_organization_projects
Full name
bugsnag.bugsnag_list_organization_projects
ParameterTypeRequiredDescription
No parameters.
list_projects Read

List Bugsnag projects visible to the authenticated user.

Lua path
app.integrations.bugsnag.list_projects
Full name
bugsnag.bugsnag_list_projects
ParameterTypeRequiredDescription
No parameters.
get_project Read

Get details for a Bugsnag project.

Lua path
app.integrations.bugsnag.get_project
Full name
bugsnag.bugsnag_get_project
ParameterTypeRequiredDescription
No parameters.
list_collaborators Read

List collaborators for a Bugsnag organization.

Lua path
app.integrations.bugsnag.list_collaborators
Full name
bugsnag.bugsnag_list_collaborators
ParameterTypeRequiredDescription
No parameters.
get_collaborator Read

Get one Bugsnag collaborator.

Lua path
app.integrations.bugsnag.get_collaborator
Full name
bugsnag.bugsnag_get_collaborator
ParameterTypeRequiredDescription
No parameters.
list_teams Read

List Bugsnag teams for an organization.

Lua path
app.integrations.bugsnag.list_teams
Full name
bugsnag.bugsnag_list_teams
ParameterTypeRequiredDescription
No parameters.
get_team Read

Get one Bugsnag team.

Lua path
app.integrations.bugsnag.get_team
Full name
bugsnag.bugsnag_get_team
ParameterTypeRequiredDescription
No parameters.
list_errors Read

List errors for a Bugsnag project.

Lua path
app.integrations.bugsnag.list_errors
Full name
bugsnag.bugsnag_list_errors
ParameterTypeRequiredDescription
No parameters.
get_error Read

Get details for a Bugsnag error.

Lua path
app.integrations.bugsnag.get_error
Full name
bugsnag.bugsnag_get_error
ParameterTypeRequiredDescription
No parameters.
update_error Write

Update a Bugsnag error status or assignment.

Lua path
app.integrations.bugsnag.update_error
Full name
bugsnag.bugsnag_update_error
ParameterTypeRequiredDescription
No parameters.
delete_error Write

Delete a Bugsnag error.

Lua path
app.integrations.bugsnag.delete_error
Full name
bugsnag.bugsnag_delete_error
ParameterTypeRequiredDescription
No parameters.
list_error_events Read

List events for a specific Bugsnag error.

Lua path
app.integrations.bugsnag.list_error_events
Full name
bugsnag.bugsnag_list_error_events
ParameterTypeRequiredDescription
No parameters.
list_project_events Read

List events for a Bugsnag project.

Lua path
app.integrations.bugsnag.list_project_events
Full name
bugsnag.bugsnag_list_project_events
ParameterTypeRequiredDescription
No parameters.
get_event Read

Get details for a Bugsnag event.

Lua path
app.integrations.bugsnag.get_event
Full name
bugsnag.bugsnag_get_event
ParameterTypeRequiredDescription
No parameters.
get_project_trend Read

Get time-series trend data for a Bugsnag project.

Lua path
app.integrations.bugsnag.get_project_trend
Full name
bugsnag.bugsnag_get_project_trend
ParameterTypeRequiredDescription
No parameters.
list_pivot_values Read

List Bugsnag pivot values for an error.

Lua path
app.integrations.bugsnag.list_pivot_values
Full name
bugsnag.bugsnag_list_pivot_values
ParameterTypeRequiredDescription
No parameters.
list_project_releases Read

List releases for a Bugsnag project.

Lua path
app.integrations.bugsnag.list_project_releases
Full name
bugsnag.bugsnag_list_project_releases
ParameterTypeRequiredDescription
No parameters.
get_project_release Read

Get a Bugsnag project release.

Lua path
app.integrations.bugsnag.get_project_release
Full name
bugsnag.bugsnag_get_project_release
ParameterTypeRequiredDescription
No parameters.
create_organization_event_data_request Write

Create an organization-wide event data request for privacy workflows.

Lua path
app.integrations.bugsnag.create_organization_event_data_request
Full name
bugsnag.bugsnag_create_organization_event_data_request
ParameterTypeRequiredDescription
No parameters.
get_organization_event_data_request Read

Get organization event data request status.

Lua path
app.integrations.bugsnag.get_organization_event_data_request
Full name
bugsnag.bugsnag_get_organization_event_data_request
ParameterTypeRequiredDescription
No parameters.
create_project_event_data_request Write

Create a project event data request for privacy workflows.

Lua path
app.integrations.bugsnag.create_project_event_data_request
Full name
bugsnag.bugsnag_create_project_event_data_request
ParameterTypeRequiredDescription
No parameters.
get_project_event_data_request Read

Get project event data request status.

Lua path
app.integrations.bugsnag.get_project_event_data_request
Full name
bugsnag.bugsnag_get_project_event_data_request
ParameterTypeRequiredDescription
No parameters.
notify_error Write

Report an error event to the Bugsnag Error Reporting API.

Lua path
app.integrations.bugsnag.notify_error
Full name
bugsnag.bugsnag_notify_error
ParameterTypeRequiredDescription
No parameters.
notify_build Write

Notify Bugsnag of a build or release.

Lua path
app.integrations.bugsnag.notify_build
Full name
bugsnag.bugsnag_notify_build
ParameterTypeRequiredDescription
No parameters.
report_session Write

Report a session to the Bugsnag Session Tracking API.

Lua path
app.integrations.bugsnag.report_session
Full name
bugsnag.bugsnag_report_session
ParameterTypeRequiredDescription
No parameters.