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.
Using it today
Section titled “Using it today”Because the package is unpublished, install it from a checkout of the platform repository:
pip install -e clients/python-sdk/packages/flowcatalystPin 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.
What it covers
Section titled “What it covers”| 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 |
A client
Section titled “A client”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", [...])FlowCatalystuses anhttpx.AsyncClient. Passhttp_client=to share your own; it is then not closed byaclose(). Use it asasync with.FlowCatalystSyncruns the same async client on a private event-loop thread. It cannot be used inside a running event loop; useFlowCatalystthere.ClientCredentialsis 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_SECRETand an optional{prefix}APP_CODE;FlowCatalyst.from_settings(settings)builds a client from it. A missing variable raisesKeyErrornaming it. There is deliberately no fallback between id variables, so a login client is never used where a service account is needed.
Behaviour
Section titled “Behaviour”| 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. |
Errors
Section titled “Errors”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 |
Platform configuration
Section titled “Platform configuration”fc.platform_config (and the same on FlowCatalystSync) has list(app), get, set, delete and
reveal_secret(app, section, property, client_id=None).
list,getandsetreturn the literal"***"asvaluefor aSECRETproperty, for every caller.reveal_secretis the only way to read the plaintext, and every call is audited.- Reveal needs
platform:admin:config:reveal(a platform administrator) orplatform:application-service:config:reveal(an application’s service account, which the platform confines to its own applications and linked clients). - The result’s
valueis a pydanticSecretStr, redacted inrepr,strand JSON. Read it withresult.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 iscode == "NOT_A_SECRET"; useget. set,deleteandreveal_secrettakeon_behalf_of="<who>", sent asX-On-Behalf-Ofand 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_identifierbeside the storedclient_id.
Ingestions
Section titled “Ingestions”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 aclient(id or identifier).IngestionDefinition(name,source,split,target) is typed per kind (HttpSource,SftpSource, …,CustomSource(type=..., settings={...})for a runtime extension’s kind). Secrets areSecretRef(name=...): names, never values. - Lists return a page with
next_cursor;iter()anditer_failures()follow it (async client only). update(id, definition, expected_version=...): a stale version, or a taken code, is aConflictError(codeisINGESTION_CODE_EXISTS,INGESTION_SET_OWNED, …).- Drafts. Without the promote permission,
create,updateandsave_versionsave a draft:result.save.outcome == "DRAFT"andsave.awaiting_promoteis true until someone with promote callsmake_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 anddismiss_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.
Develop and test
Section titled “Develop and test”cd clients/python-sdkpython3 -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/pyrightAll 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.