# Configuration

Lynx AI Agent should be configured before it's used for the first time. The agent can be configured either through the Splunk Web UI or by editing the configuration files directly.

## Setup from Splunk Web (Recommended)

> [!NOTE]
>
> Also applies for Search-Head Cluster deployment. Configuring on one server is sufficient, it'll be replicated to all other members.

1. Navigate to `Apps > Lynx AI Agent for Splunk`. The first time the app is opened, it starts the setup. Click **Get started**.
2. Under **Connect to Lynx AI**, fill in:

   - `Server`: The backend server's host name, with a port number if needed. Defaults to `api.lynxai.dev`.
   - `Protocol`: Defaults to `HTTPS`.
3. Click **Continue**.
4. Enter your `License key`: UUID that authenticates with the Lynx AI backend. Once the backend accepts the key, its expiry date is shown below the field.
5. Click **Finish setup**.

> [!TIP]
>
> After the initial setup, admins can change the backend server and the license key at any time from the [Settings](<https://docs.trylynx.ai/usage/settings/index.md#agent-configuration>) page.
>
> The setup itself can also be run again by navigating in Splunk to:
>
> ```text
> /app/lynx_ai_agent/onboarding_experience
> ```
>
> This is hidden from normal navigation but can be accessed again by using the URL directly.

## Setup from configuration files

> [!NOTE]
>
> Also applies for Search-Head Cluster deployment. Configure the app on the **Deployer** and apply the bundle.

While configuration via files is supported, **UI configuration is recommended**. To run the setup again after initial configuration, set `is_configured = 0` in `local/ai.conf` and reload the app:

```ini
[install]
is_configured = 0
```

See [ai.conf](<https://docs.trylynx.ai/advanced/config-spec/ai.conf/index.md>) for advanced configuration options.

1. Navigate to `$SPLUNK_HOME/etc/apps/lynx_ai_agent`.
2. Create `local/ai.conf` with the following configuration:

   ```ini
   [install]
   is_configured = 1
   ```

   For on-premises deployments, add the backend server configuration:

   ```ini
   [backend]
   schema = https
   server = example.com:3000
   ```
3. Create `local/passwords.conf` and configure the license key. See [passwords.conf](<https://docs.trylynx.ai/advanced/config-spec/passwords.conf/index.md>).
4. Restart Splunk with `$SPLUNK_HOME/bin/splunk restart`.

> [!WARNING]
>
> Passwords set manually **will not** be encrypted by the Splunk instance. Use the UI for proper encryption.

## Stanza Naming Rules

When configuring stanzas in the format `[::<value>]`, the `<value>` portion supports only alphanumeric characters and the following special characters: `-` `/` `:` `_`

Note that consecutive colons (`::`) are not supported, as we use them to denote the separator inside the stanza name.

**✅ Good example:** `[riskyCommand::foreach]`

**❌ Bad example:** `[riskyCommand::for::each!]`

> [!TIP]
>
> Review manual changes to configuration files against the [ai.conf](<https://docs.trylynx.ai/advanced/config-spec/ai.conf/index.md>) specification before restarting Splunk or reloading the app.
