From 45fab4719ed61915486b1ef64813d7adee9f03eb Mon Sep 17 00:00:00 2001
From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com>
Date: Wed, 11 Mar 2026 15:32:52 +0000
Subject: [PATCH] feat: add preview parameter to execute workflow methods
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add optional preview parameter to workflow execution methods in both sync and async clients. When enabled, this parameter allows workflows to return mock resources instead of persisting data to the FHIR server, enabling testing and development workflows.
Key changes:
- Add optional `preview` parameter to `WorkflowsClient.execute()` method
- Add optional `preview` parameter to `AsyncWorkflowsClient.execute()` method
- Add `preview` field to `ExecuteWorkflowResponse` type to indicate preview mode
- Update raw client methods to pass preview parameter in request payload
🌿 Generated with Fern
---
.fern/metadata.json | 4 ++--
changelog.md | 3 +++
pyproject.toml | 2 +-
reference.md | 8 ++++++++
src/phenoml/core/client_wrapper.py | 4 ++--
src/phenoml/workflows/client.py | 16 ++++++++++++++--
src/phenoml/workflows/raw_client.py | 10 ++++++++++
.../workflows/types/execute_workflow_response.py | 4 ++++
8 files changed, 44 insertions(+), 7 deletions(-)
diff --git a/.fern/metadata.json b/.fern/metadata.json
index a3ccea9..214386a 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -5,6 +5,6 @@
"generatorConfig": {
"client_class_name": "PhenomlClient"
},
- "originGitCommit": "cdfe611a02d68f09dbce1eb259387269402552fb",
- "sdkVersion": "9.0.0"
+ "originGitCommit": "670d2f19d924d953196b4131bb16a252f2b6148f",
+ "sdkVersion": "9.1.0"
}
\ No newline at end of file
diff --git a/changelog.md b/changelog.md
index 4ec42e9..2510822 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,3 +1,6 @@
+## 9.1.0 - 2026-03-11
+* The workflow execution methods now support an optional `preview` parameter. When set to true, workflows return mock resources instead of persisting data to the FHIR server, enabling safe testing and development.
+
## 9.0.0 - 2026-03-11
* The `ErrorResponse` type has been removed from the summary module. If your code references `phenoml.summary.ErrorResponse` or imports it directly, you'll need to update your error handling logic to use the appropriate error types for your specific use case.
diff --git a/pyproject.toml b/pyproject.toml
index a04a9d1..2165cd0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ dynamic = ["version"]
[tool.poetry]
name = "phenoml"
-version = "9.0.0"
+version = "9.1.0"
description = ""
readme = "README.md"
authors = []
diff --git a/reference.md b/reference.md
index f714f31..f935b42 100644
--- a/reference.md
+++ b/reference.md
@@ -6689,6 +6689,14 @@ client.workflows.execute(
-
+**preview:** `typing.Optional[bool]` — If true, create operations return mock resources instead of persisting to the FHIR server
+
+
+
+
+
+-
+
**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
diff --git a/src/phenoml/core/client_wrapper.py b/src/phenoml/core/client_wrapper.py
index f21da3c..e13d82d 100644
--- a/src/phenoml/core/client_wrapper.py
+++ b/src/phenoml/core/client_wrapper.py
@@ -27,12 +27,12 @@ def get_headers(self) -> typing.Dict[str, str]:
import platform
headers: typing.Dict[str, str] = {
- "User-Agent": "phenoml/9.0.0",
+ "User-Agent": "phenoml/9.1.0",
"X-Fern-Language": "Python",
"X-Fern-Runtime": f"python/{platform.python_version()}",
"X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}",
"X-Fern-SDK-Name": "phenoml",
- "X-Fern-SDK-Version": "9.0.0",
+ "X-Fern-SDK-Version": "9.1.0",
**(self.get_custom_headers() or {}),
}
token = self._get_token()
diff --git a/src/phenoml/workflows/client.py b/src/phenoml/workflows/client.py
index b08af65..790051a 100644
--- a/src/phenoml/workflows/client.py
+++ b/src/phenoml/workflows/client.py
@@ -279,6 +279,7 @@ def execute(
id: str,
*,
input_data: typing.Dict[str, typing.Any],
+ preview: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> ExecuteWorkflowResponse:
"""
@@ -292,6 +293,9 @@ def execute(
input_data : typing.Dict[str, typing.Any]
Input data for workflow execution
+ preview : typing.Optional[bool]
+ If true, create operations return mock resources instead of persisting to the FHIR server
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -315,7 +319,9 @@ def execute(
},
)
"""
- _response = self._raw_client.execute(id, input_data=input_data, request_options=request_options)
+ _response = self._raw_client.execute(
+ id, input_data=input_data, preview=preview, request_options=request_options
+ )
return _response.data
@@ -622,6 +628,7 @@ async def execute(
id: str,
*,
input_data: typing.Dict[str, typing.Any],
+ preview: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> ExecuteWorkflowResponse:
"""
@@ -635,6 +642,9 @@ async def execute(
input_data : typing.Dict[str, typing.Any]
Input data for workflow execution
+ preview : typing.Optional[bool]
+ If true, create operations return mock resources instead of persisting to the FHIR server
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -666,5 +676,7 @@ async def main() -> None:
asyncio.run(main())
"""
- _response = await self._raw_client.execute(id, input_data=input_data, request_options=request_options)
+ _response = await self._raw_client.execute(
+ id, input_data=input_data, preview=preview, request_options=request_options
+ )
return _response.data
diff --git a/src/phenoml/workflows/raw_client.py b/src/phenoml/workflows/raw_client.py
index 2c4e08a..b14f8d8 100644
--- a/src/phenoml/workflows/raw_client.py
+++ b/src/phenoml/workflows/raw_client.py
@@ -543,6 +543,7 @@ def execute(
id: str,
*,
input_data: typing.Dict[str, typing.Any],
+ preview: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[ExecuteWorkflowResponse]:
"""
@@ -556,6 +557,9 @@ def execute(
input_data : typing.Dict[str, typing.Any]
Input data for workflow execution
+ preview : typing.Optional[bool]
+ If true, create operations return mock resources instead of persisting to the FHIR server
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -569,6 +573,7 @@ def execute(
method="POST",
json={
"input_data": input_data,
+ "preview": preview,
},
headers={
"content-type": "application/json",
@@ -1162,6 +1167,7 @@ async def execute(
id: str,
*,
input_data: typing.Dict[str, typing.Any],
+ preview: typing.Optional[bool] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[ExecuteWorkflowResponse]:
"""
@@ -1175,6 +1181,9 @@ async def execute(
input_data : typing.Dict[str, typing.Any]
Input data for workflow execution
+ preview : typing.Optional[bool]
+ If true, create operations return mock resources instead of persisting to the FHIR server
+
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -1188,6 +1197,7 @@ async def execute(
method="POST",
json={
"input_data": input_data,
+ "preview": preview,
},
headers={
"content-type": "application/json",
diff --git a/src/phenoml/workflows/types/execute_workflow_response.py b/src/phenoml/workflows/types/execute_workflow_response.py
index 61e4e8a..acd41bd 100644
--- a/src/phenoml/workflows/types/execute_workflow_response.py
+++ b/src/phenoml/workflows/types/execute_workflow_response.py
@@ -19,6 +19,10 @@ class ExecuteWorkflowResponse(UniversalBaseModel):
"""
results: typing.Optional[ExecuteWorkflowResponseResults] = None
+ preview: typing.Optional[bool] = pydantic.Field(default=None)
+ """
+ Whether the workflow was executed in preview mode
+ """
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2