Introducing a new way to review your PRs.

Read the announcement

zipstack / unstract

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

View on GitHub

28 documents · Updated Nov 23, 2026

docs / platform-services

Platform support services

Platform support services provide the shared capabilities that the backend and worker fleet need to run workflows. The platform service gives SDK and tool code a controlled path to platform data and usage records. The runner gives workers an isolated place to start and manage tool containers. Together with the asynchronous workers, these services connect workflow requests to tool execution without placing container work inside the backend process.

Service boundary

The support layer separates platform access, asynchronous task handling, and isolated tool execution. The backend remains the main system for product requests. Workers carry out background work. The platform service and runner supply the shared capabilities that those workers need.

The main service roles are:

ServicePurposeMain consumers
Platform serviceAuthenticates platform-key requests and exposes tenant-scoped platform data, cache, and usage operationsSDK clients, tools, and worker-side integrations
Worker fleetConsumes asynchronous work and coordinates workflow, file, callback, notification, and scheduled tasksBackend and message transports
Runner serviceStarts isolated tool containers and returns their status, logs, and resultsWorkers that execute tools

The following flow shows how a workflow moves from the backend and workers to an isolated tool process and back to platform state.

flowchart LR
    Backend[Backend] -->|queues background work| Workers[Worker fleet]
    SDK[SDK or tool client] -->|platform-key API calls| Platform[Platform service]
    Workers -->|reads platform data and records usage| Platform
    Workers -->|execution request| Runner[Runner service]
    Runner -->|starts and monitors| Tool[Isolated tool container]
    Tool -->|logs and result| Runner
    Runner -->|execution outcome| Workers
    Workers -->|workflow state and callbacks| Backend

Platform service

The platform service is a REST boundary between SDK or tool code and platform data. It accepts an active bearer platform key, checks that the key has the required UUID format, and resolves the related organization. Failed checks deny access and expose only a short key prefix in logs. This identity keeps data access and usage records tied to the correct tenant. See the platform service page for its focused service view.

Its API supports the data needed during execution rather than owning the full workflow. It can return platform details, adapter settings, exported Prompt Studio and Agentic Studio definitions, and LLM profile data. It also accepts page and token usage records. Adapter lookups reject deprecated adapters with a client-facing error before execution code tries to resolve them. A Redis-backed cache gives callers a small shared store whose keys are scoped by organization.

The service depends on the platform database for organization, configuration, and usage data. It also depends on Redis for cache access. Requests use common request IDs and JSON error responses so callers can correlate failures with the wider request flow.

References: platform-service/README.md• L1-16 platform-service/…/config.py• L22-55 platform-service/…/platform.py• L24-145 platform-service/…/platform.py• L147-184 platform-service/…/platform.py• L187-288 platform-service/…/platform.py• L291-348 platform-service/…/platform.py• L351-400 platform-service/…/platform.py• L403-493 platform-service/…/adapter_instance.py• L11-52 platform-service/…/test_adapter_instance_deprecation.py• L1-81 platform-service/…/test_auth_middleware.py• L1-111

Worker fleet

The worker fleet is the asynchronous work layer around the backend. A unified worker entry point selects a worker type and loads the tasks for that role. The roles divide work by responsibility so file processing, execution, callbacks, notifications, scheduling, logs, API deployment, and IDE completion work can run independently.

Workers use named queues to route each task to the right role. The normal fleet uses Celery and its message broker. The repository also provides an opt-in PostgreSQL queue path with dedicated consumers and a recovery process. This allows transport migration without changing the product-level work split, but both transport and queue assignment must remain consistent.

Worker startup also provides shared infrastructure such as API clients, cache access, health reporting, and worker configuration. The worker entry point checks task registration before it reports readiness. During graceful shutdown it preserves broker heartbeats so unfinished tasks are less likely to be requeued as duplicates.

References: workers/worker.py• L34-55 workers/worker.py• L327-335 workers/worker.py• L417-443 workers/worker.py• L445-535 workers/…/__init__.py• L1-42 workers/…/worker_enums_base.py• L12-27 workers/…/worker_enums_base.py• L146-186 workers/run-worker.sh• L91-186 workers/run-worker.sh• L994-1043

Runner service

The runner service is the isolation boundary for tool execution. A worker sends the tool image, execution identifiers, settings, environment, and message channel. The runner starts the requested image through the container runtime, then reports status and execution events without making the worker host run tool code directly. See the runner service page for its focused service view.

The runner can inspect tool image metadata before execution. During a run it tracks the organization, workflow, execution, and file execution identifiers. It streams structured tool logs and publishes correlated events when a message channel is present. An optional sidecar can consume shared logs while the main tool container runs. The sidecar receives the configured log transport and stream queue name, so its log messages use the same delivery path as the rest of the log flow. The default path remains Celery, while Redis can carry the stream when that option is enabled.

The runner exposes endpoints for starting a container, checking its status, removing it, and asking a tool image for supported metadata. It also exposes a health endpoint for service supervision. The container client keeps the runtime behind a service boundary, which leaves room for different container backends while preserving the runner contract.

References: runner/README.md• L1-4 runner/…/__init__.py• L13-27 runner/…/__init__.py• L1-9 runner/…/run.py• L12-78 runner/…/health.py• L7-14 runner/…/runner.py• L38-48 runner/…/runner.py• L49-129 runner/…/runner.py• L217-268 runner/…/runner.py• L408-577 runner/…/interface.py• L34-145 runner/…/constants.py• L33-53 runner/…/test_sidecar_log_transport.py• L1-84

Execution flow

The execution path joins queue work with an isolated runtime. A file-processing worker prepares the workflow and file metadata, calls the runner, and retries temporary request failures. The runner turns that request into a tool-container run. The result then returns to the worker, which continues the workflow and updates the backend-facing state.

The service boundary is useful because each part has a different failure and scaling model:

  1. The backend or a client creates work and platform context.
  2. A worker receives the work from its assigned queue.
  3. The worker obtains the required platform configuration and usage context.
  4. The runner starts the tool image in an isolated container.
  5. The runner streams logs and tracks the execution outcome.
  6. The worker consumes the outcome and completes the workflow or callback.

The file-processing integration carries execution and pipeline identifiers into the runner request. Those identifiers link tool logs, usage, file state, and callback work across service boundaries.

References: workers/…/tasks.py• L2065-2149 runner/…/run.py• L12-49 runner/…/runner.py• L453-537 runner/…/runner.py• L538-577

Operational dependencies

The services run as separate containers in the local platform stack. The platform service needs the database and Redis. The runner needs access to the container runtime and shared execution data. Its sidecar also needs the selected log transport: Redis for the Redis path or the Celery broker for the default path. Workers need the broker and the shared platform data services that support their tasks.

The stack starts the backend, platform service, runner, and worker services as separate units. The runner receives a Docker socket mount so it can create tool containers. Worker health ports support liveness checks in deployed environments. The platform service and runner each expose a simple health endpoint, while worker supervision also checks whether the worker process is alive.

The platform startup script creates or merges service environment files. It creates the encryption key used by the backend and platform service during first setup. That key is part of the data contract for stored adapter credentials and must remain stable for existing data to stay readable.

References: docker/docker-compose.yaml• L16-55 docker/docker-compose.yaml• L160-204 docker/docker-compose.yaml• L207-230 run-platform.sh• L209-265 run-platform.sh• L301-334 workers/run-worker.sh• L299-317

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the worker-to-runner URL, request fields, execution identifiers, and result shape aligned across workers/…/tasks.py and the runner routes.
  • Keep platform-key format checks, active-key lookup, fail-closed authentication, and masked authentication logs aligned with platform callers and authentication tests.
  • Keep adapter availability state and the platform service's client error aligned with the adapter registry so deprecated adapters fail before execution.
  • Keep worker task registration, queue names, worker aliases, and transport-specific consumers aligned when a task moves between Celery and the PostgreSQL queue path.
  • Preserve the same encryption key across backend and platform-service deployments when adapter credentials already exist.
  • Keep runner image, sidecar image, shared log volume, and cleanup behavior aligned when changing tool execution or log collection.
  • Keep the runner and sidecar log transport, stream queue name, and available broker or Redis service aligned with the log consumer path.
  • Keep service health ports and compose dependencies aligned with deployment liveness checks.

Important failure modes

TriggerConsequenceGuard
A platform key is missing, malformed, unknown, or inactive, or its lookup failsPlatform API calls return unauthorized and workers cannot obtain platform dataValidate the key format, check the active key, and fail closed when the lookup fails
The platform encryption key changes after adapter data is storedExisting adapter credentials cannot be decryptedPreserve and back up the shared key used by the backend and platform service
A project still refers to a deprecated adapterThe platform service returns a clear client error instead of allowing a later adapter-resolution failureKeep adapter availability state current and reconfigure projects with a supported adapter
The runner cannot reach the container runtime or the requested image is unavailableTool execution returns an error before workflow work can completeKeep the Docker runtime mount, registry access, image name, and image tag valid
The sidecar uses a different log transport or stream queue from the consumerTool logs can stop reaching live updates and stored execution logs without a tool-run errorForward the transport and queue settings to the sidecar and keep them aligned with the active consumer
A worker starts without its task registration or consumes the wrong queueWork stays queued or a worker starts but processes nothingTreat queue mappings and non-empty task registration as one deployment contract
The worker caller and runner route or payload drift apartFile processing cannot submit work or cannot interpret the execution resultChange the caller and runner contract together and preserve execution and pipeline identifiers

Key files

FileWhy to read it
docker/docker-compose.yamlShows how the backend, platform service, runner, and worker services are connected and what runtime resources they receive.
platform-service/…/platform.pyShows the platform-facing contract for authentication, organization context, usage, cache, and execution configuration lookup.
platform-service/…/test_auth_middleware.pyDefines the authentication contract for valid, rejected, malformed, and database-error token cases without exposing full keys in logs.
platform-service/…/adapter_instance.pyShows how adapter lookup scopes data to an organization and rejects adapters that are no longer available.
platform-service/…/config.pyShows how the platform service exposes routes, shared request behavior, database access, and plugins.
runner/…/run.pyShows the runner API boundary for tool start, status, removal, and image metadata requests.
runner/…/runner.pyShows the high-level execution lifecycle from container setup through logs, status, result, and cleanup.
runner/…/docker_client.pyShows the container-runtime boundary and the isolation, image, volume, and cleanup concerns behind the runner.
workers/worker.pyShows how one worker entry point selects a role, initializes shared support, loads tasks, and manages lifecycle safety.
workers/run-worker.shShows the worker roles, queue groups, health model, and the separate Celery and PostgreSQL queue launch paths.
workers/…/tasks.pyShows how a worker crosses the runner boundary for file and workflow execution.
run-platform.shShows the local stack setup flow and the shared encryption-key requirement.