KosmoKrator

data

SEC EDGAR Lua API for KosmoKrator Agents

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

Lua Namespace

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

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

Workflow file

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

workflow.lua
local sec_edgar = app.integrations.sec_edgar
local result = sec_edgar.submissions({})

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

MCP-only Lua

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

SEC EDGAR

Namespace: sec-edgar

SEC EDGAR exposes public filing history and standardized XBRL data through data.sec.gov. No API key is required, but automated access must use an identifiable User-Agent and stay within SEC fair-access guidance.

Submissions

local filings = sec_edgar.submissions({
  cik = "320193",
})

CIKs are normalized to SEC’s 10-digit form automatically. If the response contains additional files in filings.files, fetch those files with:

local older = sec_edgar.submission_file({
  file = "CIK0000320193-submissions-001.json",
})

XBRL Company Facts

local facts = sec_edgar.company_facts({
  cik = "320193",
})

local accounts_payable = sec_edgar.company_concept({
  cik = "320193",
  taxonomy = "us-gaap",
  tag = "AccountsPayableCurrent",
})

company_facts returns the full standardized facts tree for a filer. company_concept narrows to one taxonomy and tag.

Frames

local frame = sec_edgar.frames({
  taxonomy = "us-gaap",
  tag = "AccountsPayableCurrent",
  unit = "USD",
  period = "CY2019Q1I",
})

Period examples:

  • CY2019 for annual duration data
  • CY2019Q1 for quarterly duration data
  • CY2019Q1I for point-in-time instant data

Ticker Mappings

local tickers = sec_edgar.company_tickers({})
local exchanges = sec_edgar.company_tickers_exchange({})

These return SEC-published CIK/ticker/company-title mappings.

Bulk Archives

local archives = sec_edgar.bulk_archives({})

This returns the official SEC ZIP archive URLs. The tool does not download the ZIP files because they are large and should be fetched deliberately by a host workflow.

Raw agent markdown
# SEC EDGAR

Namespace: `sec-edgar`

SEC EDGAR exposes public filing history and standardized XBRL data through `data.sec.gov`. No API key is required, but automated access must use an identifiable User-Agent and stay within SEC fair-access guidance.

## Submissions

```lua
local filings = sec_edgar.submissions({
  cik = "320193",
})
```

CIKs are normalized to SEC's 10-digit form automatically. If the response contains additional files in `filings.files`, fetch those files with:

```lua
local older = sec_edgar.submission_file({
  file = "CIK0000320193-submissions-001.json",
})
```

## XBRL Company Facts

```lua
local facts = sec_edgar.company_facts({
  cik = "320193",
})

local accounts_payable = sec_edgar.company_concept({
  cik = "320193",
  taxonomy = "us-gaap",
  tag = "AccountsPayableCurrent",
})
```

`company_facts` returns the full standardized facts tree for a filer. `company_concept` narrows to one taxonomy and tag.

## Frames

```lua
local frame = sec_edgar.frames({
  taxonomy = "us-gaap",
  tag = "AccountsPayableCurrent",
  unit = "USD",
  period = "CY2019Q1I",
})
```

Period examples:

- `CY2019` for annual duration data
- `CY2019Q1` for quarterly duration data
- `CY2019Q1I` for point-in-time instant data

## Ticker Mappings

```lua
local tickers = sec_edgar.company_tickers({})
local exchanges = sec_edgar.company_tickers_exchange({})
```

These return SEC-published CIK/ticker/company-title mappings.

## Bulk Archives

```lua
local archives = sec_edgar.bulk_archives({})
```

This returns the official SEC ZIP archive URLs. The tool does not download the ZIP files because they are large and should be fetched deliberately by a host workflow.
Metadata-derived Lua example
local result = app.integrations.sec_edgar.submissions({})
print(result)

Functions

submissions Read

Retrieve current public filing history for a CIK.

Lua path
app.integrations.sec_edgar.submissions
Full name
sec-edgar.sec_edgar_submissions
ParameterTypeRequiredDescription
No parameters.
submission_file Read

Retrieve an additional paginated submissions JSON file.

Lua path
app.integrations.sec_edgar.submission_file
Full name
sec-edgar.sec_edgar_submission_file
ParameterTypeRequiredDescription
No parameters.
company_facts Read

Retrieve all standardized XBRL company facts for a CIK.

Lua path
app.integrations.sec_edgar.company_facts
Full name
sec-edgar.sec_edgar_company_facts
ParameterTypeRequiredDescription
No parameters.
company_concept Read

Retrieve one taxonomy concept across filings for a CIK.

Lua path
app.integrations.sec_edgar.company_concept
Full name
sec-edgar.sec_edgar_company_concept
ParameterTypeRequiredDescription
No parameters.
frames Read

Retrieve an XBRL frame across reporting entities.

Lua path
app.integrations.sec_edgar.frames
Full name
sec-edgar.sec_edgar_frames
ParameterTypeRequiredDescription
No parameters.
company_tickers Read

Retrieve SEC CIK, ticker, and company-title mappings.

Lua path
app.integrations.sec_edgar.company_tickers
Full name
sec-edgar.sec_edgar_company_tickers
ParameterTypeRequiredDescription
No parameters.
ticker_exchanges Read

Retrieve SEC CIK, ticker, exchange, and company-title mappings.

Lua path
app.integrations.sec_edgar.ticker_exchanges
Full name
sec-edgar.sec_edgar_company_tickers_exchange
ParameterTypeRequiredDescription
No parameters.
bulk_archives Read

Return official SEC bulk archive ZIP URLs.

Lua path
app.integrations.sec_edgar.bulk_archives
Full name
sec-edgar.sec_edgar_bulk_archives
ParameterTypeRequiredDescription
No parameters.