Skip to content

Automate browser based workflows with AI

Add current_date to reserved parameters list (#SKY-7547) (#4854)

Celal Zamanoğlua5205598565c
diff --git a/fern/workflows/workflow-parameters.mdx b/fern/workflows/workflow-parameters.mdx
index cb2e8f1d3..e0b5d3710 100644
--- a/fern/workflows/workflow-parameters.mdx
+++ b/fern/workflows/workflow-parameters.mdx
@@ -54,7 +54,14 @@ Pick the credential to use when running the workflow when you have defined a cre
## Reserved Parameters
There are some parameters that are reserved by Skyvern and cannot be used as a parameter key/name:
-- `{{current_value}}`: this is a reserved parameter within the scope of a for loop block. It represents the current value that the loop is iterating over.
+- `{{current_item}}`: the current item in a for-loop block iteration (alias for `current_value`).
+- `{{current_value}}`: the current value that the for-loop block is iterating over.
+- `{{current_index}}`: the zero-based index of the current for-loop iteration.
+- `{{current_date}}`: automatically resolves to the current date in YYYY-MM-DD format (UTC).
+- `{{workflow_title}}`: the title of the workflow.
+- `{{workflow_id}}`: the unique ID of the workflow definition.
+- `{{workflow_permanent_id}}`: the permanent ID that persists across workflow versions.
+- `{{workflow_run_id}}`: the unique ID of the current workflow run.
## Block Output Parameters
Any block name ({{your_block_name}} or {{your_block_name_output}}) can be referenced as a parameter by a later block, with the exception of referencing a block within a for loop from outside of the for loop block.
diff --git a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterEditPanel.tsx b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterEditPanel.tsx
index e0e8164ae..2ed948d7b 100644
--- a/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterEditPanel.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/panels/WorkflowParameterEditPanel.tsx
@@ -180,6 +180,11 @@ function WorkflowParameterEditPanel({
"current_item",
"current_value",
"current_index",
+ "current_date",
+ "workflow_title",
+ "workflow_id",
+ "workflow_permanent_id",
+ "workflow_run_id",
"workflow_run_outputs",
];
const isCloud = useContext(CloudContext);
diff --git a/skyvern/forge/sdk/workflow/models/block.py b/skyvern/forge/sdk/workflow/models/block.py
index c8949dec4..14c36c0cb 100644
--- a/skyvern/forge/sdk/workflow/models/block.py
+++ b/skyvern/forge/sdk/workflow/models/block.py
@@ -117,6 +117,9 @@ else:
jinja_sandbox_env = SandboxedEnvironment()
+# Date format used for the built-in {{current_date}} reserved parameter.
+CURRENT_DATE_FORMAT = "%Y-%m-%d"
+
# Sentinel marker for native JSON type injection via | json filter.
_JSON_TYPE_MARKER = "__SKYVERN_RAW_JSON__"
@@ -399,6 +402,8 @@ class Block(BaseModel, abc.ABC):
template_data["workflow_permanent_id"] = workflow_run_context.workflow_permanent_id
if "workflow_run_id" not in template_data:
template_data["workflow_run_id"] = workflow_run_context.workflow_run_id
+ if "current_date" not in template_data:
+ template_data["current_date"] = datetime.now(timezone.utc).strftime(CURRENT_DATE_FORMAT)
template_data["workflow_run_outputs"] = workflow_run_context.workflow_run_outputs
template_data["workflow_run_summary"] = workflow_run_context.build_workflow_run_summary()
@@ -5059,6 +5064,7 @@ class BranchEvaluationContext:
template_data.setdefault("workflow_id", ctx.workflow_id)
template_data.setdefault("workflow_permanent_id", ctx.workflow_permanent_id)
template_data.setdefault("workflow_run_id", ctx.workflow_run_id)
+ template_data.setdefault("current_date", datetime.now(timezone.utc).strftime(CURRENT_DATE_FORMAT))
template_data.setdefault("params", template_data.get("params", {}))
template_data.setdefault("outputs", template_data.get("outputs", {}))
diff --git a/skyvern/forge/sdk/workflow/models/parameter.py b/skyvern/forge/sdk/workflow/models/parameter.py
index 5ddde2fc7..51c7a094d 100644
--- a/skyvern/forge/sdk/workflow/models/parameter.py
+++ b/skyvern/forge/sdk/workflow/models/parameter.py
@@ -12,6 +12,7 @@ RESERVED_PARAMETER_KEYS = [
"current_item",
"current_value",
"current_index",
+ "current_date",
"workflow_title",
"workflow_id",
"workflow_permanent_id",