Skip to content

nb serve

nb serve launches the NimbleBrain runtime and starts an HTTP API server. This is the production entry point — it boots the agent engine, loads all configured bundles, and listens for HTTP requests.

nb serve [flags]
FlagDescriptionDefault
--port <number>Server port27247
--config <path>Config file pathAuto-resolved (see config resolution)
--workdir <dir>Working directory~/.nimblebrain
--model <name>Override default modelFrom config
--debugVerbose loggingOff
Terminal window
nb serve
[nimblebrain] Starting runtime...
[nimblebrain] Runtime ready.

The server listens on port 27247 by default. Override with --port:

Terminal window
nb serve --port 8080

You can also set the port via the PORT environment variable:

Terminal window
PORT=8080 nb serve
  1. The config file is loaded and validated
  2. The runtime initializes — loading bundles, skills, and model configuration
  3. Structured logging is disabled unless --debug is set (keeps stdout/stderr clean for production)
  4. The HTTP server starts listening on the configured port

For production, set the required environment variables and run nb serve:

Terminal window
export ANTHROPIC_API_KEY=sk-ant-api03-...
export NB_API_KEY=your-secret-api-key-here
export ALLOWED_ORIGINS=https://app.example.com
nb serve --port 27247

The NB_API_KEY protects the API with Bearer token authentication. The ALLOWED_ORIGINS controls CORS. See the Authentication and Security docs for details.

Enable verbose logging to see every event the runtime processes:

Terminal window
nb serve --debug

In debug mode, each event is dumped as JSON to stderr. Without --debug, the server runs quietly — only startup and shutdown messages are printed.

Point to a specific config file:

Terminal window
nb serve --config /etc/nimblebrain/nimblebrain.json

Or set a custom working directory (the server looks for nimblebrain.json inside it):

Terminal window
nb serve --workdir /opt/nimblebrain
  • nb dev — development mode with file watching and HMR
  • nb status — check workspace health
  • nb reload — hot-reload config on a running server
  • CLI Overview — global flags and config resolution