# keryn runtime init

Describes Keryn 0.5.2 and keryn-rules 0.8.0.

> keryn runtime init: Keryn Runtime (IAST, RASP, request inspection): install the agent into an application, verify it, report its events

Source: https://keryn.dev/docs/reference/cli/runtime-init/

> **Caution: Next release: keryn runtime init**
> On main; not in Keryn 0.5.2, the latest release.

Keryn Runtime (IAST, RASP, request inspection): install the agent into an application, verify it, report its events.

```text
keryn runtime init [dir] [--app <id>] [--dry-run] [--json]
```

## Options

```text
Usage: keryn runtime init [dir] [--app <id>] [--dry-run] [--json]
       keryn runtime check [dir] [--app <id>] [--json]
       keryn runtime report <events.jsonl | log export> <out-dir> [--declared <ops.json>] [--json]
  Keryn Runtime is an agent that runs inside your application: IAST reports where request input reaches a sensitive
  operation, RASP refuses a dangerous operation as the code is about to perform it, and Edge inspects each request in
  front of the handler. It covers Deno and Supabase Edge Functions, Cloudflare Workers, Vercel, Netlify and Node.
  init    finds what the application in <dir> (default: the current directory) runs on, copies a pinned copy of the agent
          next to the code and wires it in: completely for Supabase Edge Functions, Cloudflare Workers and Node; for Vercel and
          Netlify handlers it prints the lines to add. --dry-run shows the plan and writes nothing. Safe to run again.
          Nothing it adds changes behaviour until a KERYN_RUNTIME_* variable is set in the application's environment.
  check   exits 1 when a pinned copy was edited or an entry point lost its wiring. For CI.
  report  reads the agent's events (KERYN_RUNTIME_REPORT=file:<path>, or a platform log export with "keryn.rt" lines) and
          writes summary.md, findings.json and analysis.json to <out-dir>. --declared lists the operations each function
          is meant to serve, so that undeclared ones are reported.
  The agent ships inside this CLI and is verified against its sha256 manifest before it is copied. Nothing is downloaded
  and nothing is sent. KERYN_RUNTIME_PACK=<dir> reads another unpacked agent release.
  Exit 0 done; 1 no supported entry point found, or a failed check; 2 bad usage or an unreadable pack or events file.
```

## Examples

```sh
# Show what would be copied and wired in this directory; write nothing.
keryn runtime init --dry-run

# Install into one application of a repository, naming it in reports.
keryn runtime init apps/api --app api
```

## Exit codes

| Code | Meaning |
|---|---|
| 0 | installed, or the plan was printed |
| 1 | no supported entry point was found |
| 2 | not a directory, bad usage, or the agent inside the CLI failed its checksum |

## Environment

| Variable | Meaning | Default |
|---|---|---|
| `KERYN_RUNTIME_PACK` | Directory of another unpacked Keryn Runtime release, used by keryn runtime in place of the agent inside this CLI. | the agent inside this CLI |
