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

# Dynamic Classifier setup

> Deploy and configure the dynamic-classifier service, which trains and runs the models behind Document Classifiers.

The dynamic-classifier service trains and runs the machine-learning models behind [Document Classifiers](https://docs.flowx.ai/6.x/docs/platform-deep-dive/integrations/document-classifiers.md). Integration Designer calls it in two ways:

* Over REST, to classify document pages when a workflow runs a Document Classifier.
* Over Kafka, to train a model version and to pre-label pages uploaded without labels. The pre-labeling uses an LLM judge.

## Dependencies

* [**Kafka**](https://docs.flowx.ai/6.x/setup-guides/kafka-authentication-config.md): training and judge jobs from Integration Designer
* **PostgreSQL**: job store for those jobs (see [Job store](#job-store-postgresql))
* **S3-compatible storage** (MinIO or AWS S3): trained model versions (see [Object storage](#object-storage))
* **A persistent volume**: 20Gi `ReadWriteOnce`, for the service's own data and model cache (see [Persistent volume](#persistent-volume))
* **organization-manager**: resolves the model and credentials for the judge from the organization's `EVAL` capability in [AI providers](https://docs.flowx.ai/6.x/ai-platform/ai-providers.md)

***

## Turn on the service

dynamic-classifier is in the `runtime` group of the `flowx-ai` Helm chart. To deploy it, set `groups.runtime.enabled: true`. The `runtime` group also needs the AI base, so set `groups.base.enabled: true` as well. See [Service groups](https://docs.flowx.ai/6.x/setup-guides/migrate-to-flowx-ai-helm-chart.md#service-groups) for the valid group combinations.

***

## Configuration

The chart sets every variable this section needs from its values. The tables list the variables so you can check a running pod or override a value.

### Persistent volume

The chart creates the PersistentVolumeClaim `dynamic-classifier-data` (20Gi, `ReadWriteOnce`) and mounts it in three places:

| Mount path | Volume subpath | Holds |
| - | - | - |
| `/code/.data` | `data` | The service's own database (SQLite): classifier definitions, labeled pages, classification log |
| `/code/.artifacts` | `artifacts` | Local copies of model versions |
| `/tmp/fastembed_cache` | `fastembed` | The downloaded text encoder model |

Your cluster needs a storage class that can provision this claim. Because the volume is `ReadWriteOnce` and the service keeps its database on it, run one replica and keep `GUNICORN_WORKERS` at `1`. The deployment uses the `Recreate` strategy, so an upgrade stops the old pod before the new one starts.

### Job store (PostgreSQL)

Integration Designer's training and judge jobs run through a durable job queue that keeps each job's state in PostgreSQL. Create the `dynamic_classifier` database and the `dynamic_classifier` user before you deploy: the chart connects to the database but doesn't create it. The chart reads the password from the `flowx-postgres-dynamic-classifier` secret, key `password`.

| Environment Variable | Description | Default Value |
| - | - | - |
| `POSTGRES_URI` | PostgreSQL host and port, without a scheme | `postgresql:5432` |
| `POSTGRES_DATABASE` | Database name | `dynamic_classifier` |
| `POSTGRES_USERNAME` | Database user. The chart sets `dynamic_classifier` | `flowx` |
| `POSTGRES_PASSWORD` | Required. Database password | - |
| `POSTGRES_DSN` | Full connection string (`postgresql+asyncpg://user:password@host:port/database`). When set, it overrides the four variables above | - |

> [!WARNING]
>
> If `POSTGRES_PASSWORD` is not set (and `POSTGRES_DSN` is not used), the job consumer fails at startup with a `postgres_dsn is required` error.

### Object storage

When Integration Designer trains a model version, the service uploads it to object storage as a zip, under `dynamic-classifier/artifacts/` in the bucket. Set the bucket in `services.dynamic-classifier.component.s3.applicationFileStorage.bucketName`. The chart ships it empty.

> [!WARNING]
>
> Training a Document Classifier from FlowX needs the bucket. If `APPLICATION_FILE_STORAGE_S3_BUCKET_NAME` is empty, every training job fails after the model is built, with an `artifact store disabled` error. Importing a model still works without the bucket: the imported version stays on the persistent volume only.

| Environment Variable | Description | Default Value |
| - | - | - |
| `APPLICATION_FILE_STORAGE_S3_BUCKET_NAME` | Bucket for trained model versions. Required for training | `""` |
| `APPLICATION_FILE_STORAGE_S3_DOCUMENTS_SERVER_URL` | Object storage endpoint. An `https://` URL turns on TLS. Takes precedence over `MINIO_DOCUMENTS_URL` | `minio:9000` |
| `APPLICATION_FILE_STORAGE_S3_DOCUMENTS_ACCESS_KEY` | Access key. Takes precedence over `MINIO_DOCUMENTS_ACCESS_KEY` | `""` |
| `APPLICATION_FILE_STORAGE_S3_DOCUMENTS_SECRET_KEY` | Secret key. Takes precedence over `MINIO_DOCUMENTS_SECRET_KEY` | `""` |
| `MINIO_DOCUMENTS_SECURE` | Use TLS when the endpoint has no scheme | `false` |

The chart takes the access key from `global.flowx.s3.credentials.dynamicClassifier.accessKey` (default `flowx-dynamic-classifier-accesskey`) and the secret key from the `flowx-dynamic-classifier-s3` secret, key `SecretAccessKey`.

### Kafka configuration

The chart sets `TRAINING_QUEUE` to `kafka`, which starts the job consumer for Integration Designer's training and judge jobs. With any other value, the consumer doesn't start and Integration Designer's jobs are never picked up. Create the topics before you deploy the service if your Kafka cluster doesn't create topics automatically.

| Topic | Direction |
| - | - |
| `ai.flowx.dynamic-classifier.job.request.v1` | Integration Designer → dynamic-classifier (consume) |
| `ai.flowx.dynamic-classifier.job.response.v1` | dynamic-classifier → Integration Designer (produce) |
| `ai.flowx.dynamic-classifier.job.dlq.v1` | dynamic-classifier → dead-letter topic (produce) |

| Environment Variable | Description | Default Value |
| - | - | - |
| `TRAINING_QUEUE` | `kafka` starts the job consumer. Set by the chart | `thread` |
| `KAFKA_BOOTSTRAP_SERVERS` | Kafka broker address | `kafka:9092` |
| `KAFKA_JOB_REQUEST_TOPIC` | Job request topic | `ai.flowx.dynamic-classifier.job.request.v1` |
| `KAFKA_JOB_RESPONSE_TOPIC` | Job response topic | `ai.flowx.dynamic-classifier.job.response.v1` |
| `KAFKA_JOB_DLQ_TOPIC` | Dead-letter topic | `ai.flowx.dynamic-classifier.job.dlq.v1` |
| `DYNAMIC_CLASSIFIER_KAFKA_CONSUMER_GROUP` | Consumer group ID for jobs | `dynamic-classifier-jobs` |

For the shared Kafka connection settings, see [Kafka in AI Platform setup](https://docs.flowx.ai/6.x/setup-guides/ai-platform-setup.md#kafka).

### LLM judge

Judge jobs from Integration Designer use the model bound to the organization's `EVAL` capability. To change it, assign `EVAL` to another model in **Settings** → **AI Providers** → **Models**. If the organization has no `EVAL` model, judge jobs fail.

The service can also call an OpenAI model directly for its own judge and label refinement calls. The chart reads that key from the `dynamic-classifier-openai` secret, key `OPENAI_API_KEY`. The secret is optional: without it, the service skips those calls and classification keeps working.

| Environment Variable | Description | Default Value |
| - | - | - |
| `DC_JUDGE_MODEL` | Model ID that replaces the `EVAL` model for judge jobs | - |
| `DC_JUDGE_CONCURRENCY` | LLM calls one judge job makes at the same time | `8` |
| `OPENAI_API_KEY` | OpenAI key for the service's own judge and label refinement calls. Optional | - |

### Text encoder model and egress

The first time the service needs its text encoder (`prithivida/Splade_PP_en_v1`), it downloads the model from Hugging Face and caches it on the persistent volume, under `/tmp/fastembed_cache`. Later restarts reuse the cached copy.

> [!WARNING]
>
> Air-gapped environments must allow the Hugging Face download once, or copy the model into the `fastembed` subpath of the volume before the first training or classification.

### Server configuration

| Environment Variable | Description | Default Value |
| - | - | - |
| `URL_PREFIX` | Path prefix for the API | `/dynamic-classifier` |
| `GUNICORN_WORKERS` | Gunicorn worker processes. The chart sets `1`: keep it | `1` |
| `GUNICORN_TIMEOUT` | Worker timeout in seconds | `600` |
| `SCHEDULER_ENABLED` | In-service retraining scheduler. The chart sets `false` | `true` |

The API listens on port `8080`. The port isn't configurable.

### Integration Designer connection

Integration Designer reaches the service through the chart's `dynamic-classifier` Service (port `80`). Change these Integration Designer variables only if you expose the service under another name:

| Environment Variable | Description | Default Value |
| - | - | - |
| `FLOWX_DYNAMICCLASSIFIER_BASEURL` | Base URL of the dynamic-classifier API | `http://dynamic-classifier:80/dynamic-classifier` |
| `FLOWX_DYNAMICCLASSIFIER_TIMEOUTSECONDS` | Timeout for a classification call, in seconds | `120` |
| `FLOWX_DYNAMICCLASSIFIER_HEALTHTIMEOUTSECONDS` | Timeout for the health check made before a classification, in seconds | `3` |

***

## Verify your setup

> [!TIP]
>
> The pod is running: `kubectl get pods -l app.kubernetes.io/component=dynamic-classifier`

> [!TIP]
>
> The volume claim is bound: `kubectl get pvc dynamic-classifier-data`

> [!TIP]
>
> The health endpoint returns HTTP 200: `curl http://dynamic-classifier-mngt:8081/manage/actuator/health`

> [!TIP]
>
> Training works end to end: train a Document Classifier version in FlowX and check that it finishes, then look for its zip under `dynamic-classifier/artifacts/` in the bucket

***

## Troubleshooting

> [accordion] Pod stays Pending
>
> **Symptoms:** The pod never starts and `kubectl describe pod` shows an unbound volume claim.
>
> **Solutions:**
>
> * Check that a storage class can provision a 20Gi `ReadWriteOnce` claim for `dynamic-classifier-data`
> * If you scaled the deployment above one replica, scale it back to one: a second pod can't mount the same `ReadWriteOnce` volume on another node

> [accordion] Training fails with an artifact store error
>
> **Symptoms:** A training job fails and the pod logs show `artifact store disabled (APPLICATION_FILE_STORAGE_S3_BUCKET_NAME unset)`.
>
> **Solutions:**
>
> * Set `services.dynamic-classifier.component.s3.applicationFileStorage.bucketName` and redeploy (see [Object storage](#object-storage))
> * Check that the bucket exists and the access key can write to it

> [accordion] Training or pre-labeling jobs never finish
>
> **Symptoms:** Integration Designer sends jobs, but the service never answers.
>
> **Solutions:**
>
> * Check that `TRAINING_QUEUE` is `kafka` on the pod
> * Check that the three job topics exist and the service can consume the request topic
> * Check that the [job store](#job-store-postgresql) connection works: the logs show `postgres_dsn is required` when the password is missing
> * Review the pod logs for Kafka connection or authentication errors

> [accordion] Pre-labeling fails
>
> **Symptoms:** Pages uploaded without labels aren't pre-labeled, and the logs show `No EVAL llm-config capability configured for this organization`.
>
> **Solutions:**
>
> * Assign a model to the `EVAL` capability in **Settings** → **AI Providers** → **Models** for the organization

> [accordion] First training or classification fails in an air-gapped environment
>
> **Symptoms:** The logs show a failed model download for `prithivida/Splade_PP_en_v1`.
>
> **Solutions:**
>
> * Allow egress to Hugging Face once, or copy the model into the `fastembed` subpath of the volume (see [Text encoder model and egress](#text-encoder-model-and-egress))

***

## Related resources

> [card] [Document classifiers](https://docs.flowx.ai/6.x/docs/platform-deep-dive/integrations/document-classifiers.md)
>
> Train or import models and use them in workflows

> [card] [AI Platform setup](https://docs.flowx.ai/6.x/setup-guides/ai-platform-setup.md)
>
> Deploy the AI Platform services and their shared configuration

> [card] [Integration Designer setup](https://docs.flowx.ai/6.x/setup-guides/integration-designer-setup.md)
>
> Configure Integration Designer, which sends the classification and training requests

> [card] [Configure the flowx-ai Helm chart](https://docs.flowx.ai/6.x/setup-guides/configure-flowx-ai-helm-chart.md)
>
> Point the chart at your PostgreSQL, S3, and Kafka


## Related topics

- [AI Platform setup](https://docs.flowx.ai/6.x/setup-guides/ai-platform-setup.md)
- [Migrate self-hosted FlowX.AI to the flowx-ai Helm chart](https://docs.flowx.ai/6.x/setup-guides/migrate-to-flowx-ai-helm-chart.md)
- [Microservices setup guides](https://docs.flowx.ai/6.x/setup-guides/setup-guides-overview.md)
- [Deployment guidelines v6.0.0](https://docs.flowx.ai/release-notes/v6.x/v6.0.0-october-2026/deployment-guidelines-v6.0.md)
- [Configuring access roles for processes](https://docs.flowx.ai/6.x/setup-guides/flowx-engine-setup-guide/configuring-access-roles-for-processes.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.