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

# Configuration

> AutomationConfig, skip rules, escalation rules, and the engine's environment reference.

# Configuration

## AutomationConfig

Each brand's workflow binding holds a JSON `AutomationConfig` that drives all behavior. This is
what makes one workflow serve every brand.

| Field                    | Contains                                                      |
| ------------------------ | ------------------------------------------------------------- |
| `skip_rules`             | `business_hours`, `ticket_age`, `intent_filter`               |
| `escalation_rules`       | Patterns, action, tags                                        |
| `context_sources`        | `shopify_customer`, `recharge_subscription`, `knowledge_base` |
| `tool_definitions`       | LLM function schemas                                          |
| `system_prompt_template` | Prompt with variable substitution                             |
| LLM settings             | `model`, `temperature`, `max_tokens`, `max_rounds`            |
| `classification`         | Phases with labels and `gate_labels`                          |
| `review_gate`            | `min_confidence`, `escalation_always_review`                  |
| `dispatch`               | `add_tags`, `set_status`, `channel`                           |
| `post_actions`           | Snooze workflows                                              |

## Skip rules

Skip rules cause an early exit with **no response generated**. They are evaluated in order and
**the first matching rule wins**.

```
Ticket ─▶ Business hours?  ──outside──▶ Skip
              │ within
          Ticket age?      ──too old──▶ Skip
              │ fresh
          Intent filter?   ──matched──▶ Skip
              │ no match
          Continue to automation
```

Business-hours evaluation is **DST-aware** via `chrono-tz`, so a brand's hours behave correctly
across clock changes rather than drifting by an hour twice a year.

## Escalation rules

Pattern-based detection of sensitive topics in ticket text.

| Pattern type | Example                  | Match style                                  |
| ------------ | ------------------------ | -------------------------------------------- |
| Literal      | `"lawsuit"`              | Case-insensitive contains                    |
| Regex        | `"cancel.*subscription"` | Compiled regex — cached, 512 max, 10KB limit |

| Action             | Behavior                                       |
| ------------------ | ---------------------------------------------- |
| `tag_and_skip`     | Add tags, return without generating a response |
| `tag_and_review`   | Add tags, continue but force the review gate   |
| `tag_and_continue` | Add tags, proceed normally                     |

<Tip>
  `tag_and_continue` still lets the agent answer — it only marks the ticket. If a pattern
  describes something the agent genuinely shouldn't handle alone, use `tag_and_review` or
  `tag_and_skip`.
</Tip>

The regex cache is bounded at 512 entries with a 10KB pattern limit, so a pathological config
can't exhaust memory.

## Environment

### Temporal and API

| Variable                              | Default                        |
| ------------------------------------- | ------------------------------ |
| `TEMPORAL_SERVER`                     | `http://localhost:7233`        |
| `TEMPORAL_NAMESPACE`                  | `default`                      |
| `TEMPORAL_TASK_QUEUE`                 | `stateset-response-automation` |
| `TEMPORAL_MAX_CACHED_WORKFLOWS`       | `1000`                         |
| `TEMPORAL_HEALTH_PROBE_TIMEOUT_SECS`  | `3`                            |
| `TEMPORAL_HEALTH_PROBE_INTERVAL_SECS` | `10`                           |
| `API_BIND_ADDR`                       | `0.0.0.0:8080`                 |

### Control plane

| Variable                                             | Purpose                                                  |
| ---------------------------------------------------- | -------------------------------------------------------- |
| `CONTROL_PLANE_DATABASE_URL` (or `DATABASE_URL`)     | Required to enable the control plane                     |
| `CONTROL_PLANE_AUTH_MODE`                            | `required` (default), `optional`, `disabled`             |
| `CONTROL_PLANE_API_KEYS_JSON`                        | Recommended over `CONTROL_PLANE_API_KEY`                 |
| `CONTROL_PLANE_TEMPORAL_ENABLED`                     | `true` to dispatch into Temporal                         |
| `CONTROL_PLANE_DISPATCH_*`                           | Dispatcher poll and retry behavior                       |
| `DISPATCH_HEALTH_REFRESH_INTERVAL_SECS`              | `30` — API background refresh of dispatch-health metrics |
| `CONTROL_PLANE_PARITY_*`                             | Migration parity gates                                   |
| `CONTROL_PLANE_ALLOWED_TASK_QUEUES` / `_PREFIXES`    | Scope permitted Temporal task queues                     |
| `CONTROL_PLANE_ALLOWED_WORKFLOW_NAMES` / `_PREFIXES` | Scope permitted workflow names                           |

`AppConfig::validate()` runs at startup in both the API and worker, so an invalid configuration
**fails fast** rather than surfacing as a runtime error later.

### Dashboard

| Variable                  | Purpose                          |
| ------------------------- | -------------------------------- |
| `VITE_ENGINE_API_BASE`    | Engine API the dashboard targets |
| `ENGINE_API_PROXY_TARGET` | Local dev proxy target           |

<Warning>
  In local development the dashboard proxies to the **production** engine API unless
  `ENGINE_API_PROXY_TARGET` is set. Set it before running the dashboard locally.
</Warning>

### Logging

Structured JSON logging via `tracing` and `tracing-subscriber`, configured by `RUST_LOG`.

## Related

* [ResponseAutomationV2](/next-temporal/workflow)
* [Control plane](/next-temporal/control-plane)
* [Operations](/next-temporal/operations)
