agentcrumbs

Environment variable

Configure agentcrumbs with the AGENTCRUMBS env var

In Node.js, everything is controlled by a single AGENTCRUMBS environment variable. In the browser, use configure() instead.

Shorthand values

ValueEffect
1Enable all namespaces
*Enable all namespaces
trueEnable all namespaces
(unset)Disabled. All calls are noop.
AGENTCRUMBS=1 node your-app.js

Namespace filter

Non-JSON string values are treated as namespace filters:

AGENTCRUMBS=auth-*           # Wildcard match
AGENTCRUMBS=auth-service     # Exact match

JSON config

For full control, pass a JSON object:

# Enable specific namespaces
AGENTCRUMBS='{"ns":"auth-*,api-*"}'

# With exclusions
AGENTCRUMBS='{"ns":"* -internal-*"}'

# Custom port
AGENTCRUMBS='{"ns":"*","port":9999}'

# JSON output format (instead of pretty)
AGENTCRUMBS='{"ns":"*","format":"json"}'

# Explicit app name
AGENTCRUMBS='{"app":"my-project","ns":"*"}'

Config schema

FieldTypeDefaultDescription
appstring(auto-detect)App name. Defaults to nearest package.json name
nsstring(required)Namespace filter pattern
portnumber8374Collector HTTP port
format"pretty" | "json""pretty"Output format for stderr

App name

Every crumb is stamped with an app name. This keeps crumbs from different projects separate.

The app name is resolved in this order:

  1. app field in the JSON config
  2. AGENTCRUMBS_APP environment variable
  3. Auto-detected from the nearest package.json name field (walking up from cwd)
  4. Fallback: "unknown"
# Override via dedicated env var
AGENTCRUMBS_APP=my-project AGENTCRUMBS=1 node app.js

Namespace patterns

  • * matches everything
  • auth-* matches auth-service, auth-oauth, etc.
  • auth-*,api-* matches multiple patterns (comma or space separated)
  • * -internal-* matches everything except namespaces starting with internal-

On this page