Connector platform
The connector platform gives workflows a stable way to read data from external systems and send results to external systems. It separates connector definitions, saved connector access, authentication, and worker processing so a workflow can use a provider without carrying provider-specific rules.
Platform role
The platform turns a connector choice into a shared data path between a workflow and an external system. A connector declares what it is, which direction it supports, how it is configured, and how it is authenticated. The platform then uses that information to present valid choices and to create the access needed by the workflow.
The connector platform is part of the wider connectors and tools system. Connectors move data across the workflow boundary. The tool runtime transforms that data inside the workflow; see tool runtime for that related boundary.
Connector packages
Connector packages group providers by the kind of external resource they serve. Each package gives its providers a common contract, while the platform keeps the provider identity and capability data in one catalog.
Filesystem connectors
Filesystem connectors give workflows a common view of file stores. They can provide file listing, file reads, metadata, directory checks, and output writes when the provider supports those actions. The same boundary covers local storage and remote stores, so source processing does not need a separate workflow path for each provider.
The S3/MinIO connector also applies a resource boundary when a bucket is configured. It treats the bucket as the connector root, keeps file paths relative to that root, and checks access to account-listed buckets before showing them. This prevents a connector from exposing unrelated buckets and keeps discovery paths consistent with browser listings. Transient throttling can retry once and keep a bucket visible. Access, deletion, and endpoint-region failures remove that bucket from the list, while unknown or system-wide failures remain visible as errors.
Unstract Cloud Storage reuses the S3-compatible behavior but uses its own path setting as the access boundary. Its credentials are expected to have full access to the relevant storage, so it does not use the per-bucket probe or require a bucket setting.
References: unstract/…/minio.py• L27-167 unstract/…/minio.py• L170-209 unstract/…/minio.py• L370-388 unstract/…/exceptions.py• L8-50 unstract/…/ucs.py• L8-21 unstract/…/test_miniofs.py• L254-338
Database connectors
Database connectors give workflows a common way to test access, open a database connection, run queries, and write structured results. The connector layer also adapts values and table changes to the rules of each database family. This lets destination processing treat database output as one product feature rather than as a set of separate provider flows.
References: unstract/…/unstract_db.py• L21-107 unstract/…/unstract_db.py• L151-224 unstract/…/unstract_db.py• L226-323
Queue connectors
Queue connectors support message-based destinations such as manual review. Their shared contract lets the workflow place work in a queue and inspect or remove queued items. The destination layer uses this path when a result needs human review instead of direct publication.
References: unstract/…/unstract_queue.py• L9-79 unstract/…/unstract_queue.py• L81-136 workers/…/destination_connector.py• L562-597 workers/…/destination_connector.py• L717-739
Connector catalog
The connector catalog is the shared source of connector identity and capability data. Active provider packages register their classes with a stable ID. The catalog combines filesystem, database, and queue entries, then exposes names, descriptions, icons, configuration schemas, read and write support, OAuth support, and connector mode to the backend and workers.
This catalog is a discovery layer, not a saved user connection. A workflow stores a connector instance with the selected ID and its protected settings. At run time, the worker resolves that ID back to the matching connector class and supplies the saved settings.
The following flow shows how a provider package becomes a usable workflow connection.
flowchart LR
A[Connector package] --> B[Active connector catalog]
B --> C[Capability and settings schema]
C --> D[Saved connector instance]
D --> E[Worker connector object]
E --> F[External system access]
Connector capabilities
Connector capabilities control where a connector can appear in the product. Read support makes a connector eligible as workflow input. Write support makes it eligible as workflow output. Connector mode groups the connection as a filesystem, database, API, or manual-review path.
The catalog also carries a JSON schema, which defines the settings form and its expected shape. For S3/MinIO, the schema requires a connector name, endpoint, region, and bucket. It permits access keys to remain blank when the deployment supplies credentials through an IAM role or instance profile. The connector uses the selected endpoint and bucket to limit the connection to the intended storage resource.
References: unstract/…/base.py• L7-78 unstract/…/connectorkit.py• L16-32 unstract/…/connectorkit.py• L74-114 backend/…/connector_processor.py• L47-131 unstract/…/json_schema.json• L1-46 unstract/…/minio.py• L179-209
Connector instances
A connector instance is an organization-scoped saved connection. It links a user-facing name to a stable connector ID, protected connector metadata, an optional shared authentication record, and sharing rules. The instance is the workflow-facing choice; the catalog remains the source for what that ID means.
The backend controls who can list, change, share, or delete an instance. It can also restrict connector creation to organization admins. This access boundary matters because a connector instance represents access to an external system, not only a display setting.
References: backend/…/models.py• L32-86 backend/…/models.py• L103-123 backend/…/views.py• L44-91 backend/…/views.py• L218-265
Authentication layer
The authentication layer keeps provider login separate from connector-specific settings. OAuth credentials first pass through a short-lived cache during the login flow. After a successful create or update, the platform links the credentials to a shared provider-and-user authentication record and stores the connector instance with the current token data.
The layer supports token refresh for connectors that use OAuth. A refreshed token is copied only to the token fields of related connector instances. Provider-specific form fields stay with their own connector instance, which prevents settings for one external resource from leaking into another.
The authentication hand-off follows a short sequence:
- The client requests an OAuth cache key for a provider.
- The OAuth flow places provider credentials in the cache under that key.
- Connector create, update, or test reads the cached credentials when the request supplies the key.
- A successful save removes the temporary cache entry.
- Later use can refresh the shared token record and update only token fields on linked instances.
References: backend/…/views.py• L17-49 backend/…/common.py• L34-64 backend/…/views.py• L143-191 backend/…/models.py• L81-122
Processing layer
The processing layer turns catalog information and saved settings into a tested connector access path. It supports three related jobs: show supported choices, return the settings schema, and test credentials before a workflow depends on them. Invalid IDs, unsupported modes, missing credentials, and provider access errors are converted into platform-level failures.
Connection health checks use the same connector resolution path as workflow access. For filesystem connections, a health check creates the connector and tests access to a configured path. In the S3/MinIO path, that check lists the configured bucket root rather than enumerating all account buckets. This makes the check useful before execution and keeps the connector boundary aligned with later reads and writes.
References: backend/…/connector_processor.py• L59-85 backend/…/connector_processor.py• L88-162 unstract/…/operations.py• L21-92 unstract/…/operations.py• L95-146 unstract/…/minio.py• L370-388
Worker connector abstractions
Workers use connector abstractions to keep workflow execution independent from the backend data store and from provider details. A source abstraction reads workflow input. A destination abstraction publishes a tool result. Both receive connection type and connector instance data, then resolve the provider through the shared catalog or worker connector service.
Source processing
The source worker loads the workflow endpoint configuration and selects either a filesystem source or API-managed execution storage. For a filesystem source, it resolves the connector, checks the requested folders, applies file patterns and processing limits, and returns file records with stable hashes and metadata. File history and active-execution checks prevent the same source file from entering conflicting runs.
References: workers/…/source.py• L29-113 workers/…/source.py• L115-259 workers/…/source_connector.py• L76-147
Destination processing
The destination worker receives the result for one file and routes it by connection type. API output is cached for retrieval. Filesystem output copies produced files to the selected store. Database output creates or updates the target table shape and inserts the result. Manual review output sends the work to a queue so a later review can decide what happens next.
The destination boundary also carries file metadata, usage data, and error information. Before it writes or queues a result, it uses a per-file lock and execution stage state to skip duplicate work after a retry or worker restart.
References: workers/…/destination_connector.py• L599-739 workers/…/destination_connector.py• L766-822 workers/…/destination_connector.py• L824-904
Worker access service
The worker connector service is the small factory boundary used when a worker needs a destination filesystem connector. It accepts the stable connector ID and connector settings, then uses the shared connector operations layer to create the provider object. This keeps worker code aligned with backend connector resolution without requiring workers to access backend models directly.
References: workers/…/service.py• L17-46 unstract/…/operations.py• L58-92
End-to-end connector flow
A workflow run moves through the connector platform in two distinct phases. The backend validates and saves the connection choice. The worker later resolves that choice, reads the input, and publishes the result through the selected output path.
sequenceDiagram
participant User as User or API client
participant Backend as Connector backend
participant Catalog as Connector catalog
participant Worker as Workflow worker
participant External as External system
User->>Backend: Select connector and provide settings
Backend->>Catalog: Check ID, mode, schema, and capabilities
Backend->>Backend: Resolve or cache authentication
Backend-->>User: Save connector instance
Worker->>Backend: Get workflow endpoint configuration
Worker->>Catalog: Resolve connector ID
Worker->>External: Read source data
Worker->>Worker: Run workflow tools
Worker->>External: Write result or queue review
The source and destination roles remain separate even when they use the same provider family. This allows a workflow to read from one system and write to another. It also lets API workflows return results without treating the API response as a file copy.
References: backend/…/views.py• L19-81 workers/…/source.py• L63-107 workers/…/destination_connector.py• L824-904
Change checklist
When these files or sections are changed, remember to consider these:
- When a connector ID, mode, or read/write capability changes, check catalog discovery, connector-instance records, source selection, and destination routing together.
- When a connector schema or setting name changes, check the schema response, saved metadata, OAuth form merge, and worker settings lookup together.
- When an object-store connector changes its resource boundary, check schema requirements, path normalization, root health checks, source discovery, and output writes together.
- When object-store probe error handling changes, check translated exception causes, retry behavior, drop versus fail-open decisions, and user-facing error conversion together.
- When OAuth token fields change, check the cache payload, shared auth record, refresh merge, and connector response redaction together.
- When a connector package is added or disabled, check package registration, optional dependency behavior, catalog filtering, and worker resolution.
- When a source or destination connection type changes, check the shared enum values and both worker routing paths because they use the same workflow contract.
- When destination write behavior changes, check file, database, API, and manual-review paths separately because each consumes the same processing result but has a different downstream contract.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A connector ID is not registered or is inactive | The platform cannot show, test, or create the selected provider | The catalog registers active providers and rejects unknown IDs |
| Connector settings do not match the connector schema | Connector creation or worker access fails before external data can move | The backend exposes the provider schema and the worker passes the saved settings to the resolved connector |
| An OAuth cache key is missing, expired, or invalid | Create or test cannot obtain provider credentials | The backend validates the cache result and removes the temporary entry only after a successful operation |
| A refreshed OAuth payload contains provider form fields | Settings from one connector can overwrite settings on a related connector | Refresh propagation allows only the defined OAuth token fields to cross connector instances |
| An S3/MinIO bucket is not configured for a bucket-scoped connector | Connector creation fails instead of allowing account-wide discovery | The connector schema requires a bucket and the connector rejects blank values |
| A bucket is inaccessible, deleted, or outside the configured endpoint region | The bucket is hidden from the connector instead of failing later during selection | The access probe drops known access, existence, and region failures |
| S3/MinIO probing is throttled | A bucket can disappear from a listing during temporary service pressure | The probe limits concurrency, retries once, and fails open for known throttling codes |
| A probe returns an unknown or system-wide error | The real account or credential problem can be hidden if the bucket is silently dropped | Unknown errors and clock-skew errors propagate to the connector error handler |
| A bucket-scoped walk returns bucket-qualified metadata names | File discovery can build a path with a duplicated bucket prefix | The scoped filesystem makes entry names relative for detailed walk results |
| A source folder is missing or inaccessible | No source files enter the workflow | Source discovery validates directories and reports an empty result for inaccessible paths |
| A destination is reached again during a retry | The workflow can write duplicate output | Per-file destination locking and execution stages skip duplicate processing |
| A destination receives neither a result nor an execution error | The file or database output cannot be written as a complete record | Destination handlers reject empty processing results before output handling |
Key files
| File | Why to read it |
|---|---|
| unstract/…/base.py | Defines the shared identity, capability, schema, and credential contract for connector packages |
| unstract/…/connectorkit.py | Shows how active connector packages become a stable-ID catalog and how workers resolve them |
| unstract/…/unstract_file_system.py | Defines the common file read, metadata, discovery, and write boundary |
| unstract/…/minio.py | Shows S3/MinIO configuration, bucket scoping, access filtering, metadata handling, and health checks |
| unstract/…/exceptions.py | Shows how S3 error codes become bucket-list decisions or user-facing connector errors |
| unstract/…/json_schema.json | Defines the user-facing S3/MinIO settings contract and bucket requirement |
| unstract/…/ucs.py | Shows the storage variant that reuses S3 behavior with its own path boundary |
| unstract/…/unstract_db.py | Defines the common database connection, query, schema, and write boundary |
| backend/…/models.py | Shows the organization-scoped saved connector instance and its protected settings |
| backend/…/views.py | Shows connector access, creation rules, sharing, and lifecycle operations |
| backend/…/models.py | Shows shared OAuth token storage and refresh propagation |
| backend/…/common.py | Shows the temporary OAuth credential hand-off and connector auth creation |
| backend/…/connector_processor.py | Shows catalog queries, schema access, capability filtering, and credential tests |
| unstract/…/operations.py | Shows common connector construction and filesystem health checks |
| workers/…/source.py | Shows how workers discover and filter workflow input files |
| workers/…/destination_connector.py | Shows how workers route results to external destinations and review queues |
| workers/…/service.py | Shows the worker factory boundary for destination filesystem access |
| unstract/…/test_miniofs.py | Guards bucket restriction, path normalization, probe decisions, retry behavior, and the UCS variant |