Skip to content

Python SDK

The SDK is async-first, with a blocking facade, and has two distributions in a uv workspace under clients/python-sdk:

Distribution Import State
flowcatalyst flowcatalyst Built (the first milestone, below)
flowcatalyst-fastapi flowcatalyst_fastapi Placeholder: a pyproject and an empty package

It requires Python 3.11 or later and depends on httpx (0.27+) and pydantic (2.7+). The code is typed and checked with strict mypy and pyright.

Because the package is unpublished, install it from a checkout of the platform repository:

Terminal window
pip install -e clients/python-sdk/packages/flowcatalyst

Pin to a commit you have reviewed, as the API can change without a version. If you only need something the preview does not cover, call the HTTP API directly with httpx or requests: authenticate with the client_credentials grant, then use the documented endpoints. The platform’s API is the same one every SDK wraps. See call the API, tokens and the API surfaces.

Area Python
Async client FlowCatalyst and blocking FlowCatalystSync Yes
Client-credentials tokens: cached, single flight, refresh on 401 Yes
Retry, timeouts, one error taxonomy Yes
Roles sync (POST /api/applications/{appCode}/roles/sync) Yes. Only roles: no other sync category
Platform configuration, with secret reveal and on-behalf-of Yes
Ingestions and ingestion sets Yes
Outbox, use cases, webhook verification, other sync categories, scheduled jobs, push, field, OIDC No
from flowcatalyst import FlowCatalyst, ClientCredentials, SyncRole
async with FlowCatalyst(
"https://platform.example.com",
credentials=ClientCredentials(client_id, client_secret),
) as fc:
result = await fc.sync.roles("orders", [SyncRole(name="planner", permissions=["orders:plan:run:execute"])])

For blocking code:

from flowcatalyst import FlowCatalystSync, ClientCredentials
with FlowCatalystSync("https://platform.example.com", credentials=ClientCredentials(client_id, client_secret)) as fc:
fc.sync.roles("orders", [...])
  • FlowCatalyst uses an httpx.AsyncClient. Pass http_client= to share your own; it is then not closed by aclose(). Use it as async with.
  • FlowCatalystSync runs the same async client on a private event-loop thread. It cannot be used inside a running event loop; use FlowCatalyst there.
  • ClientCredentials is a service-account id and secret. A plain login client is rejected by the platform.
  • Settings.from_env(prefix="FLOWCATALYST_") reads {prefix}BASE_URL, {prefix}CLIENT_ID, {prefix}CLIENT_SECRET and an optional {prefix}APP_CODE; FlowCatalyst.from_settings(settings) builds a client from it. A missing variable raises KeyError naming it. There is deliberately no fallback between id variables, so a login client is never used where a service account is needed.
Retries 408, 425, 429 and a failure to connect are retried for every request. 502, 503, 504 and a transport failure after the request was sent are retried only for an idempotent request (see below). Not 500 (it may have done the work); RetryPolicy(retry_server_error=True) opts in, for idempotent requests only.
Attempts and backoff 3 attempts; full-jitter backoff, base 100 ms, cap 5 s.
Retry-After Honoured, as seconds or an HTTP date, capped at 30 s.
Retry after a sent request GET, HEAD, OPTIONS, PUT and DELETE are idempotent; so is a call marked idempotent=True. For any other request (a plain POST) a 502, 503, 504, or a transport failure or the overall deadline after it was sent, is not retried: the SDK raises OutcomeUnknownError (the platform may have applied it; read the state before sending it again). A DELETE answered 404 on a retry after such an unknown outcome succeeds.
Timeouts connect 5 s, read 30 s, overall 60 s; override per call with Timeouts.
Tokens Cached; refreshed 60 s before expiry; one refresh-and-retry on 401, then AuthError.

No httpx exception escapes the SDK. Everything is a FlowCatalystError with status, code, message, request_id and details:

Class When
AuthError A rejected token fetch, or 401 after the one refresh
ForbiddenError 403 (the message names the missing permission)
NotFoundError 404
ConflictError 409
ValidationError 400 or 422; .fields is the platform’s details map
RateLimitedError 429 after retries; .retry_after in seconds
ServerError 5xx
NetworkError, RequestTimeoutError No response, or a timeout
OutcomeUnknownError A request that is not idempotent got 502, 503 or 504, or failed after it may have been sent. Carries method, path, status (None for a transport failure), body and cause. The raised instance is also a ServerError, RequestTimeoutError or NetworkError, so catch OutcomeUnknownError first.
PartialError A batch where some items failed; .results

fc.platform_config (and the same on FlowCatalystSync) has list(app), get, set, delete and reveal_secret(app, section, property, client_id=None).

  • list, get and set return the literal "***" as value for a SECRET property, for every caller. reveal_secret is the only way to read the plaintext, and every call is audited.
  • Reveal needs platform:admin:config:reveal (a platform administrator) or platform:application-service:config:reveal (an application’s service account, which the platform confines to its own applications and linked clients).
  • The result’s value is a pydantic SecretStr, redacted in repr, str and JSON. Read it with result.value.get_secret_value(). The SDK never caches or logs it.
  • Writing "***" or an empty value to a secret is refused (ValidationError, code == "SECRET_VALUE_MASKED" or "SECRET_VALUE_REQUIRED"). A reveal of a plain property is code == "NOT_A_SECRET"; use get.
  • set, delete and reveal_secret take on_behalf_of="<who>", sent as X-On-Behalf-Of and recorded in the audit row. The platform honours it only from a service account, and refuses more than 256 characters or a control character (INVALID_ON_BEHALF_OF).
  • List rows carry client_identifier beside the stored client_id.

fc.ingestions and fc.ingestion_sets cover the ingestion API: create, get, update, delete, pause and resume, versions (versions, save_version, make_version_live), the YAML definition, history, failures, source_kinds, connection tests (test_connection, get_test), and sets (apply(..., dry_run=True), applies, get_apply, reapply, release).

  • An ingestion needs an application (an INTEGRATION application code) and a client (id or identifier). IngestionDefinition (name, source, split, target) is typed per kind (HttpSource, SftpSource, …, CustomSource(type=..., settings={...}) for a runtime extension’s kind). Secrets are SecretRef(name=...): names, never values.
  • Lists return a page with next_cursor; iter() and iter_failures() follow it (async client only).
  • update(id, definition, expected_version=...): a stale version, or a taken code, is a ConflictError (code is INGESTION_CODE_EXISTS, INGESTION_SET_OWNED, …).
  • Drafts. Without the promote permission, create, update and save_version save a draft: result.save.outcome == "DRAFT" and save.awaiting_promote is true until someone with promote calls make_version_live. Outcomes: SAVED, MADE_LIVE, DRAFT, DRAFT_EXISTS, UNCHANGED.
  • Notices are failures the platform refused (category == "rejected"). failures(id, category="rejected", undismissed=True) lists them and dismiss_failure(id, failure_id) dismisses one. secrets(id) lists the bound secret names and each runtime’s last fetch, never a value.

The runtime operations (/api/ingestion-runtime/v1/*) are not in this SDK. See ingestion.

Only roles. fc.sync.roles(app_code, roles, remove_unlisted=False) registers a whole role set in one call. SyncRole.name must be unprefixed (the platform adds {app}:); a name with a colon is refused locally. remove_unlisted deletes SDK-sourced roles missing from the list and is off by default. The result has created, updated, deleted, synced_codes, skipped_roles and password_hash_ignored. The call is safe to repeat, so it is retried after transport errors and gateway statuses. For the other categories use another SDK’s synchronizer (Go, Java) or the sync endpoints directly; see sync definitions.

Terminal window
cd clients/python-sdk
python3 -m venv .venv && .venv/bin/pip install uv
.venv/bin/uv pip install --python .venv/bin/python -e packages/flowcatalyst \
httpx "pydantic>=2.7" pytest pytest-asyncio pytest-cov respx mypy pyright ruff
.venv/bin/python -m pytest
.venv/bin/mypy && .venv/bin/pyright

All HTTP in the tests is faked with respx; nothing touches a real platform. A contract test reads the platform’s api/openapi.lock.json and checks the operations, parameters and model fields the SDK depends on. Its models are hand-written (there is no generator), so the lock check is what keeps them honest.