Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

process

A brnr process runs one agent for one or more sessions: a headless one, which session new starts, or an editor’s, which brnr acp starts.

brnr process list

Lists the brnr processes that are running, as found in the runtime directory.

brnr process list [--json]
FlagMeaning
--jsonPrint the list as JSON.

Output (--json):

FieldTypeMeaning
processeslist of objectsOne for each process.
processes[].pidnumberThe process’s pid, as --pid and process stop take it.
processes[].statestringstarting (it hasn’t committed its start), running, stopping, or unreachable: it doesn’t answer.
processes[].ownerstring or nulleditor or headless; null when it is unreachable.
processes[].agentobjectThe agent it runs, {program, name, version} (conventions). name and version are null for a process that is unreachable.
processes[].agent.programstring or nullThe file name of the command brnr ran; null where brnr doesn’t know it.
processes[].agent.namestring or nullThe agent’s name, from initialize’s agentInfo.
processes[].agent.versionstring or nullThe agent’s version, from initialize’s agentInfo.
processes[].sessionslist of objectsIts sessions, as session list rows with session and state only.
processes[].sessions[].sessionstringThe session’s id.
processes[].sessions[].statestringAs in session list. An unreachable process’s sessions are those it holds the locks of, each unreachable.
processes[].uptimenumber or nullSeconds since it started; null when it is unreachable.
processes[].cwdstringThe directory it started in. Each session has a cwd of its own (session list).
{
  "processes": [
    {
      "pid": 4466,
      "state": "running",
      "owner": "headless",
      "agent": {
        "program": "fake_agent.py",
        "name": "fake-agent",
        "version": "1.2.3"
      },
      "sessions": [
        {
          "session": "sess-1",
          "state": "idle"
        }
      ],
      "uptime": 0,
      "cwd": "/home/me/project"
    }
  ]
}

Text output: a table of the processes, no brnr processes when there are none.

Exit codes: 0; 1 if the runtime directory isn’t private to the user.

brnr process stop

Stops a process and its agent, and so all its sessions. It closes the agent’s stdin, then sends SIGTERM, then SIGKILL, to the agent’s process group. It doesn’t wait for the process to exit.

brnr process stop <pid> [--json]
FlagMeaning
--jsonPrint what it did as JSON.

Output (--json):

FieldTypeMeaning
pidnumberThe process, as process list has it.
statusstringstopping.
{
  "pid": 4466,
  "status": "stopping"
}

Text output: stopping.

Exit codes: 0 once the process is stopping; 1 if it isn’t. Errors: process_not_found, process_unreachable, agent_exited (the agent has exited already).