Python SDK Change Log
All notable changes to this project will be documented in this file.
[4.0.0] - 2026-10-14
Changed
get_deployment()now matches the renamed catalogue keys:DeploymentModel.imagesis nowartifacts, andDeploymentImage,DeploymentImageTopicsandDeploymentImageConfigurationare nowDeploymentArtifact,DeploymentArtifactTopicsandDeploymentArtifactConfiguration.DeploymentArtifact.artifact_idreplacesimage_id.
Removed
DeploymentImage.deployment_image_id. The backend no longer returns it; usedeployment_instance_id.PipelineCommand.STATUS_GET, deprecated in 3.0.0; usePipelineCommand.RUN_STATUS.
[3.0.0] - 2026-09-28
Added
PipelineCommand.DEPLOYMENT_STATUS(pipeline.deployment.status) andPipelineCommand.ARTIFACT_GET(pipeline.artifact.get), the controller server's single-pipeline status and artifact-file download commands. Both takedeployment_instance_uuidinparameters;ARTIFACT_GETalso takesconfig_file, one of the namesDEPLOYMENT_STATUSreturns underartifact_files, and returns the file base64-encoded inresult.content. As before, plain strings work equally and nothing validates against the enum.PipelineCommand.RUN_STATUS(pipeline.run.status), the run-state command's current name.
Changed
DeploymentStorage.storage_typeanddatabase_typeare now theStorageTypeandDatabaseTypeStrEnums instead of strings. Unrecognised values parse asUNKNOWN.
Deprecated
PipelineCommand.STATUS_GET. The broker renamedpipeline.status.gettopipeline.run.statusand no longer serves the old name, so the member is now an alias ofRUN_STATUS: existing code keeps working and sends the live command,PipelineCommand.STATUS_GET is PipelineCommand.RUN_STATUS, and it no longer appears when iterating the enum. It will be removed in the next major release.client.app.publish,subscribeandflush; useclient.connectorinstead. They now call the connector service, so they requireconnector_base_url,connector_secretand mTLS settings, and emit aDeprecationWarning(plus a logged warning on first use). Return types are unchanged, but subscribe now returns one connector page per call instead of every waiting record.
Removed
client.app.controlandget_stream_url, withControlRequestModel,GetStreamUrlRequestModelandStreamUrlData.get_stream_url's endpoint never existed;controlhad no deployed consumer.
[2.0.2] - 2026-09-16
Fixed
- Environment variables that are set but blank now read as "not configured" rather than as the empty string. A deployment that emits a key for every option, valued or not, previously broke every connector request with
CA bundle not found at path:(note the empty path) while App requests kept working, because only connector requests read the CA bundle. BlankCAREFLOW_SDK_CA_BUNDLE_PATH,CAREFLOW_SDK_CLIENT_CERT_PATHandCAREFLOW_SDK_CLIENT_KEY_PATHare now unset, and surrounding whitespace is stripped from all three. Matches the .NET SDK, which runs these throughstring.IsNullOrWhiteSpace. CAREFLOW_SDK_VERIFY_SSL,CAREFLOW_SDK_TIMEOUTandCAREFLOW_SDK_MAX_RETRY_COUNTfall back to their defaults when blank or malformed instead of raisingCareflowInvalidDataError, so a bad value can no longer stop a client from starting. The rejected value is logged atWARNINGon thecareflow_sdklogger, so a typo is visible rather than silent. Matches the .NET SDK'sTryParse-with-default reads.- Connector requests with
verify_ssl=Falseno longer readca_bundle_pathat all: with verification off the bundle would never be consulted, so a configured-but-unresolvable path can no longer fail a request that .NET sends happily (it checks!VerifySslbefore loading the bundle).
[2.0.1] - 2026-09-16
Changed
- App and pipeline requests are now signed by default:
require_signingdefaults toTrueonAppRequestModel(and therefore every App request model plusPipelineExecuteRequestModel), and onpipeline.execute(...). The controller rejects unsigned App requests, so the previousFalsedefault produced requests that could not succeed; callers who were passingrequire_signing=Trueexplicitly are unaffected. Passrequire_signing=Falseto suppress the HMAC headers and exercise the rejection path. Signing resolvesclient_id/client_secret, so a client configured without them now raisesCareflowInvalidDataErrorwhen the request is built rather than being rejected by the broker. Matches the same change in the .NET SDK.
[2.0.0] - 2026-09-13
Changed
- Breaking: the HTTP layer moved from
requeststohttpx2. Thesessionoption is gone fromClientOptions(which is now inert configuration holding no live resources); to customize the transport (proxy, TLS, test stubbing), pass a pre-configuredhttpx2.ClientviaCareflowClient(options, http_client=...)— it is used as-is for every request and never closed by the SDK. Transport failures still raiseCareflowIOError/CareflowSslError, but the wrappedcauseis now an httpx2 exception. - Request models are inert: sending a request no longer mutates the model (
prepare()and the internal wire-state caching are gone), so one model instance can be reused safely across retries, threads, and clients. The pipeline is split into a pure request builder, a single-attempt transport, and response processing, with the retry loop in the client. - Breaking:
client.streaming.connect()now returns the gateway'swsgateway.WSGatewayStreamdirectly (backed bywsgateway2.0'sstream()) instead of a bare async iterator. Existingasync for msg in connect(...)loops are unaffected; the returned stream is also an async context manager and addsclose()for a graceful, lossless shutdown (stop receiving, keep iterating to drain the buffered backlog, then end) alongsideasync with/aclose()for deterministic abrupt teardown. Reconnection, backpressure (a slow consumer is throttled, never dropped), and terminal-error delivery are handled by the gateway client. - Breaking: streaming messages are now
wsgateway.WsMessage(a typed dataclass:topic/key/value/partition/offset/timestamp), yielded directly by the gateway. The SDK's ownWsMessageis removed — import it fromwsgateway, notcareflow_sdk.models. - Requires
careflow-wsgateway-client>=2.0.0,<3. - Breaking:
with_options(on the client and each service) now takes**overridestyped via a sharedTypedDictinstead of a repeated explicit signature. Passing an explicitNonenow clears the option back to env-var/default resolution; previously it meant "keep the current value". Omitting an option carries the current value over, as before. - The
User-Agentheader is nowCareflow-SDK-Python/<version>(was a stale hardcodedCareflow-SDK/1.0), so the server can distinguish SDK implementations and versions. - The package version is single-sourced from
careflow_sdk/version.py(pyproject.tomlresolves it dynamically). - Importing
careflow_sdknow installs a filter on thehttpx2logger that redacts the connector secret from its request log line, ashttpx2logs every request atINFOwith the full URL. Connectorsubscribe/flushcarry the secret as aclientSecretquery parameter, so any app enablingINFOlogging would otherwise record a live credential; the value is now written asclientSecret=REDACTED. The logger's level is not changed, and records from the application's ownhttpx2calls are never rewritten — the filter acts only while the SDK has a request in flight, tracked per-task so concurrent requests cannot affect each other. BaseClientandAsyncBaseClienteach gain apipelineabstract accessor; any third-party implementation of those ABCs must provide it.
Added
client.pipelineandAsyncCareflowClient.pipeline— a request namespace alongsideappandconnector, constructed lazily and cached like the others.pipeline.execute(command, parameters=None, *, require_signing=False), sync and awaitable — dispatches any broker command viaPOST /api/v1/pipeline. The request body is exactly{"command": ..., "parameters": ...}, withparametersdefaulting to{}when omitted. ReturnsResponseModel[dict[str, Any]]carrying the server's decoded JSON, unmodelled and unvalidated, so new broker commands work without an SDK release — there are deliberately no per-command methods.PipelineCommand—StrEnumof the commands known at release time (pipeline.deployment.get,pipeline.deployment.list,pipeline.status.get,pipeline.run.start,pipeline.run.stop), for autocomplete and typo safety. A convenience listing, not a whitelist: nothing validates against it andexecutestill accepts any string.PipelineService/CareflowPipelineServiceandAsyncPipelineService/CareflowAsyncPipelineService— service ABCs and implementations, with the samewith_optionsscoping as the other services.PipelineExecuteRequestModel— request model for the pipeline endpoint, subclassingAppRequestModelso it shares the/api/v1namespace, controller host and HMAC scheme with the App API. It overrideswire_contentto validate input and to put the defaultparameters{}on the wire;RESPONSE_BODY_MODELis leftNone, so responses pass through as a plaindict.- Local input validation on pipeline requests —
commandmust be a non-empty string andparametersa dict; either failure raisesCareflowInvalidDataErrorbefore anything reaches the wire. careflow_sdk.modelsnow exportsPipelineCommandandPipelineExecuteRequestModel.AsyncCareflowClient— anasync/awaitclient mirroringCareflowClient, for use in asyncio applications (matches the .NET SDK, whose API is async-only). Sameapp/connectorservices and options, with awaitable methods (await client.app.publish(...)); teardown isawait client.aclose()orasync with AsyncCareflowClient(...) as client. Thestreamingservice is shared with the sync client (the gateway stream is already async). The synchronousCareflowClientis unchanged.close()and context-manager support onCareflowClient. The client owns its HTTP connection pools; scopedwith_optionscopies share them, and the original owner closes.ConnectOptions.max_queue_size(backpressure buffer depth ahead of a slow consumer;0= unbounded) andConnectOptions.close_timeout(how long a graceful streamclose()waits to finish draining before force-closing). Both default to the gateway's values when unset.ConnectOptions.keepalive_intervalandConnectOptions.keepalive_timeoutfor streaming keepalive/liveness, forwarded to the WS Gateway client: it pings an idle connection everykeepalive_intervaland treats a missing pong withinkeepalive_timeoutas a dead connection (reported viaon_error, then reconnected). Both default to the gateway's values when unset (15.0/20.0seconds). Mirrors the .NET SDK'sConnectOptions.KeepAliveInterval.py.typedmarker (PEP 561): the package now advertises its inline type hints, so consumers' type checkers (mypy, pyright) use the SDK's annotations instead of treating it as untyped.DeploymentImage.storages— thestoragesarray now returned per image byget_deployment(), exposing storage/database provisioning metadata (label,storage_type,database_type,size,provider,version,instance_type,root_disk_size,share_key,is_primary_share) via the newDeploymentStoragemodel. It was previously parsed and silently discarded. Mirrors the .NET SDK'sDeploymentImage.Storages(2.6.0).- Request/response logging: each attempt logs its method, request URL, whether it was signed, the attempt number, and the response status at
DEBUGunder thecareflow_sdklogger, and retries (transport error or retryable status) atWARNING, so a retry is visible without turning onDEBUG. Silent by default (aNullHandleris attached, which also suppresseslogging.lastResort, so no level reaches stderr on its own); enable withlogging.getLogger("careflow_sdk").setLevel(logging.DEBUG). Query strings (which carry the connector secret), request bodies, and header values are never logged — only the base URL + path, method, status, and whether the request was signed.
Fixed
- mTLS misconfiguration now fails fast with
CareflowInvalidDataError: setting only one ofcert/keyraises (previously the pair was silently ignored), and both paths are checked to exist (matching the .NET SDK).~is expanded incert,key, andca_bundle_path. - A negative numeric
Retry-AfterorRetry-After-Msresponse header (from a buggy or clock-skewed upstream) crashed the retry loop viatime.sleep(negative); numeric values are now clamped to>= 0like the HTTP-date form already was. - TLS/certificate failures (
CareflowSslError) are no longer retried. They are deterministic, so retrying only delayed the real error by the full backoff schedule. - Signed requests now sign the full request path — including any path prefix on the base URL (e.g.
https://host/controller, where/controlleris part of the route) — instead of only the route (/api/v1/...). The request kept the prefix but the HMAC signature omitted it, and since the server verifies the signature over the path it receives, signed requests through a prefixed base URL failed withINVALID_SIGNATURE. The request path and the signed path are now always identical. streaming.connect()now appends/wstows_gateway_base_urlinstead of replacing the base URL's path with it, so a gateway mounted under a path prefix is reachable — e.g.wss://host/wsgatewaynow connects towss://host/wsgateway/wsrather thanwss://host/ws. Bare-host gateway URLs are unaffected.- Connector response bodies now deserialize their camelCase keys. The connector does not share the controller's snake_case convention — a live
subscribereturnsdataSetMeta, notdata_set_meta— soSubscribeResult.data_set_metawas alwaysNoneand, within it,data_type/created_time/last_modified_timewere dropped. No error was raised: the keys were simply unmodelled and every field is optional, making the loss indistinguishable from a field the server omitted. Records and totals were unaffected (their names are single words, identical under either convention). The snake_case spelling is still accepted.
Removed
- Breaking:
ConnectorStreamModelno longer hasprepare()or aconnector_secretproperty; the streaming service resolves the connector secret fromClientOptionsatconnect()time. The model is now an inert description of what to stream (topics,seek_to_latest), and no credential is stored on it. pip.iniat the repo root; the Azure Artifacts feed setup lives in the README (per-OS pip config instructions) instead.- Breaking: custom request headers are no longer supported: the
custom_headersfield andadd_headers()on request models are gone, along with the forbidden-header filter list. Request headers are owned entirely by the SDK, matching the .NET SDK (which has no custom-header API). SignatureErrorfromcareflow_sdk.utils(defined but never raised;verify_signaturereturns a bool and never raises).
[1.1.0] - 2026-07-08
Added
ConnectOptions(incareflow_sdk.models) for tuning a streaming connection, accepted as an optional second argument toclient.streaming.connect(stream_model, options). Exposes reconnection/timeout settings (reconnect_enabled,reconnect_interval,reconnect_max_interval,reconnect_max_attempts,connection_timeout,auth_timeout) and lifecycle callbacks (on_connect,on_disconnect,on_reconnect,on_error). Omitting it preserves the previous behaviour, so this is backward compatible. An unhandled exception in a callback terminates the stream and propagates unwrapped out of the iterator (.NET parity).- Default request headers
User-Agent: Careflow-SDK/1.0andRequest-Timeout: <seconds>(computed fromtimeout) are now sent on every HTTP request, matching the .NET SDK.
[1.0.0] - 2026-06-29
Added
- Initial release. Feature parity with the .NET Careflow SDK.
CareflowClientexposingapp,connector, andstreamingservices (constructed lazily and cached).- App service (
client.app):get_deployment,publish,subscribe,flush,control,get_stream_url,get_users,get_session,request_patients. Each returns a typedResponseModel[T]with.status_codeand.body. - Connector service (
client.connector):publish,subscribe,flush, plusiter_subscribefor draining a topic up to an optional limit. - Streaming (
client.streaming.connect): async-iterator WebSocket streaming over the WS Gateway, authenticated by connector secret, yieldingWsMessageobjects.ConnectorStreamModel.seek_to_latestskips the topic backlog and receives only data published after connecting (defaults toFalse). - HMAC-SHA256 request signing — opt-in per App request via
require_signing. - mTLS support via client certificate/key and CA-bundle paths.
with_optionson the client and each service for scoped option overrides; the connection pool is shared with copies unless a new session is supplied.- Configuration via constructor arguments or
CAREFLOW_SDK_*environment variables. - Typed exception hierarchy:
- Transport:
CareflowIOError,CareflowSslError. - API:
CareflowApiErrorbase withCareflowClientError/CareflowServerErrorand HTTP-status subclasses (CareflowBadRequestError,CareflowUnauthorizedError,CareflowForbiddenError,CareflowNotFoundError,CareflowRateLimitError,CareflowUnexpectedStatusCodeError). - Broker error codes:
CareflowMissingHeadersError,CareflowInvalidTimestampError,CareflowExpiredTimestampError,CareflowInvalidSignatureError,CareflowUnknownAppIdError,CareflowAuthInternalError. - Patient requests:
CareflowMissingProjectError(server code 611),CareflowMissingPatientListError(server code 612). - Validation:
CareflowValidationErrorwith structuredfield_errors. - Local input validation:
CareflowInvalidDataError.
- Transport:
responseStatusenvelope handling: numeric and string error-code dispatch, field-validation arrays, the human-readableresponseStatus.messagesurfaced on the exception, and HTML error pages (from a proxy or misconfigured route) surfaced asCareflowNotFoundError.- Automatic retries with capped exponential backoff and jitter; honors
Retry-After/Retry-After-Msandx-should-retryresponse headers.