> ## Documentation Index
> Fetch the complete documentation index at: https://docs.argentos.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Gateway Configuration

> Configure the gateway port, host, authentication, and service options.

## Overview

The gateway is configured through `argent.json`, the main configuration file located at `~/.argentos/argent.json`.

## Configuration File

```json theme={null}
{
  "gateway": {
    "port": 18789,
    "host": "0.0.0.0",
    "auth": {
      "enabled": true,
      "token": "your-gateway-auth-token"
    }
  }
}
```

## Core Settings

### Port

The WebSocket port the gateway listens on:

```json theme={null}
{
  "gateway": {
    "port": 18789
  }
}
```

Change this if port 18789 conflicts with another service.

### Host

The interface to bind to:

* `"localhost"` -- Only accept local connections (default for security)
* `"0.0.0.0"` -- Accept connections from any interface (needed for remote access)

### Authentication

Gateway auth prevents unauthorized access to the WebSocket API:

```json theme={null}
{
  "gateway": {
    "auth": {
      "enabled": true,
      "token": "a-long-random-string"
    }
  }
}
```

<Warning>
  When enabled, clients must include the token in the WebSocket connection handshake. Without authentication, anyone with network access to the gateway port can control your agent.
</Warning>

## State Directory

The gateway stores its state in:

```
~/.argentos/
  argent.json              # Main configuration
  memory.db                # MemU database
  data/
    dashboard.db           # Dashboard/tasks database
  agents/
    main/
      sessions/            # Session data
      agent/
        auth-profiles.json # Auth profiles
```

## LaunchAgent Configuration (macOS)

The `argent gateway install` command generates a plist at:

```
~/Library/LaunchAgents/ai.argent.gateway.plist
```

<Warning>
  The plist uses whatever `node` binary is first in PATH at install time. If Homebrew's node comes first, the gateway will use it instead of nvm's node, causing native module ABI mismatches. Verify the node path in the plist matches your nvm installation.
</Warning>

To fix the node path:

<Steps>
  <Step title="Edit the plist">
    Edit `~/Library/LaunchAgents/ai.argent.gateway.plist`
  </Step>

  <Step title="Change the node path">
    Update to your nvm node (e.g., `/Users/you/.nvm/versions/node/v22.22.0/bin/node`)
  </Step>

  <Step title="Reload the service">
    ```bash theme={null}
    launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/ai.argent.gateway.plist
    launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.argent.gateway.plist
    ```
  </Step>
</Steps>

## Environment Variables

| Variable            | Description                                       |
| ------------------- | ------------------------------------------------- |
| `ANTHROPIC_API_KEY` | Fallback API key (auth profiles take precedence)  |
| `ARGENT_HOME`       | Override state directory (default: `~/.argentos`) |
| `ARGENT_LOG_LEVEL`  | Logging level: debug, info, warn, error           |
