AgentKit
DocsKitsCLI ReferenceDesktop App
BetaYou are reading docs for the beta channel (3.1.0-beta.3). Features may change before the next stable release.Switch to stable →

CLI Reference

ak whoami

Resolve the current AgentKit account and live kit entitlements, including unauthenticated and renewable-session behavior.

Use ak whoami to verify which account the CLI will use and which kit grants the registry currently returns.

Usage

ak whoami

The documented command has no positional arguments. The current implementation ignores extra positional tokens; do not rely on that behavior.

Options

FlagDefaultDescription
--registry-url <url>Environment or release defaultOverride the registry used for the entitlement request.

Shared output flags are described in CLI conventions. --yes and --no-interactive do not change the query, and the command never prompts.

Before you run

The command first reads the preferred session from ~/.agentkit/auth/session.json (AGENTKIT_HOME changes the base directory). The CLI slot takes precedence over the App slot.

  • With no stored session, it performs no registry request, prints not logged in; run `ak login` to sign in, or `ak login --license-key <key>` for an AgentKit App license, and exits 1.
  • With a stored session, it rejects a registry mismatch before making a request.
  • With a matching session, it requests live entitlements. There is no entitlement-cache-only mode.
  • If the CLI access token is rejected as unauthenticated, an email session can rotate its refresh credential and an API-key session can re-mint once. A successful renewal atomically rewrites the local session before one retry.

The query is therefore not always disk-read-only.

Examples

ak whoami
ak whoami --json
ak whoami --registry-url https://registry.example.com

Use the same registry that created the stored session. To change registries, log out and log in against the intended registry rather than bypassing the mismatch check.

Output and streams

Human output on stdout reports [OK] logged in as <email> plus one kit (status) line per grant. When no email is known, the line names the sign-in method instead (logged in with a license key, logged in with an API key, or logged in by email). An empty grant list prints no licensed kits. The email falls back to the one recorded at sign-in, because the registry's entitlements response carries none.

JSON success uses kind=auth.whoami:

{
  "schema_version": 1,
  "kind": "auth.whoami",
  "data": {
    "authenticated": true,
    "email": "you@example.com",
    "authMethod": "email_otp",
    "licenses": [
      {"kitId":"engineer","status":"active","grantType":"license","productId":"engineer"}
    ]
  }
}

With no stored session, the command writes no success document. With --json, it prints the shared error envelope on stderr with auth.reason: "not_logged_in", error_code: "unknown", and exit_code: 1; stdout stays empty, so data.authenticated: false is never emitted. Runtime, registry, and session errors use the same stderr envelope. With --json enabled, unknown or invalid flags use the shared JSON stderr error envelope (error_code: validation_failed, exit 2). Human mode, including --json=false, prints Usage.

Exit status

ExitMeaningSafe next step
0The query completed and a session is signed in.Read the account and licenses[].
1No session is stored, the session store failed, registries mismatched, renewal failed, or the live entitlement request failed.Run ak login (or ak login --license-key <key> for an App license), correct the registry, then retry.
2A flag could not be parsed.Correct the invocation.

The command has no preview, apply, force, backup, or rollback path. Its only possible mutation is credential renewal.