workflow.management
Modules
Module workflow.management
API
Definitions
ballerina/workflow.management Ballerina library
Functions
cancelWorkflow
Requests graceful cancellation of a running workflow. The workflow can handle the cancellation and perform cleanup before stopping.
Parameters
- workflowId string - The workflow ID to cancel
- runId string - The specific run ID to cancel (pass empty string to use latest run)
Return Type
- error? - An error if cancellation cannot be requested
completeHumanTask
function completeHumanTask(string taskWorkflowId, anydata result, [string, string...]? callerRoles, string? userId) returns error?Completes a pending human task by sending the result back to the waiting workflow.
This is the preferred API location; workflow:completeHumanTask delegates here.
Parameters
- taskWorkflowId string - Temporal workflow ID of the human task child workflow
- result anydata - The value to return to the workflow
- callerRoles [string, string...]? (default ()) - Roles held by the caller; validated against the task's configured
userRoles
- userId string? (default ()) - Optional user identifier stored in the audit trail (from
x-user-idheader)
Return Type
- error? - An error if the task cannot be found, is already completed, or the caller is unauthorized
completeReviewActivity
function completeReviewActivity(string taskWorkflowId, ReviewDecision decision, [string, string...]? callerRoles, string? userId) returns error?Completes a pending review activity by sending the human's decision back to the
waiting workflow. The taskWorkflowId is the child workflow ID of the review
activity, available via listPendingReviewActivities or listAllReviewActivities.
Parameters
- taskWorkflowId string - Temporal workflow ID of the review activity child workflow (a bare UUID;
its
reviewactivity--prefixed kind travels in the workflow type and memo)
- decision ReviewDecision - The review decision: proceed, proceed with new input, or reject
- callerRoles [string, string...]? (default ()) - Roles held by the caller; validated against the task's configured
userRoles
- userId string? (default ()) - Optional user identifier stored in the audit trail (from
x-user-idheader)
Return Type
- error? - An error if the task cannot be found, is already completed, or the caller is unauthorized
errorCodeOf
Classifies a management error into its ErrorCode reason.
Parameters
- err Error - The error a management operation returned
Return Type
- ErrorCode - The error's protocol-independent reason
executeCommand
Executes a management operation. Parameters per operation are listed in the comment above.
This function authenticates nothing: command.identity is trusted as given, and only the role
checks the operations themselves perform apply. A caller accepting commands from a remote
channel must authenticate that channel and populate identity from a verified credential.
Parameters
- command Command - The command to execute
Return Type
- json|Error - The operation's payload, or the error explaining why it could not run
extendTaskDeadline
function extendTaskDeadline(string taskWorkflowId, int? timeoutMillis, [string, string...]? callerRoles, string? userId, IdentitySource identitySource) returns error?Moves a live task's or review's deadline: milliseconds from now, or () to let it wait indefinitely.
Only an administrator of the task may ask.
Parameters
- taskWorkflowId string - The task or review id
- timeoutMillis int? - The new deadline as milliseconds from now, or
()to clear it
- callerRoles [string, string...]? (default ()) - Roles held by the caller
- userId string? (default ()) - The caller's user id
- identitySource IdentitySource (default "asserted") -
verifiedwhen the caller's auth layer validated the identity, elseasserted
Return Type
- error? -
()on success, or an error
failHumanTask
function failHumanTask(string taskWorkflowId, string reason, map<json>? details, [string, string...]? callerRoles, string? userId) returns error?Fails (rejects) a pending human task with a reason and optional structured details.
Internally sends a rejection payload to the waiting workflow so it can handle the
rejection case. The caller's roles are validated against the task's userRoles.
Parameters
- taskWorkflowId string - Temporal workflow ID of the human task child workflow
- reason string - Human-readable reason for the rejection
- details map<json>? (default ()) - Optional structured details about the failure (recorded with the rejection)
- callerRoles [string, string...]? (default ()) - Roles held by the caller; validated against the task's
userRoles
- userId string? (default ()) - Optional user identifier stored in the audit trail (from
x-user-idheader)
Return Type
- error? - An error if the task cannot be found, is already completed, or the caller is unauthorized
getActivityTree
function getActivityTree(string workflowId, string runId) returns ActivityTreeNode[]|errorParses the workflow execution history and returns a flat ordered list of activity, child-workflow, timer, and signal nodes with their status, timing, and I/O. Human-task and retry-task child workflows are classified with their specific types.
Parameters
- workflowId string - The workflow instance ID
- runId string - The specific run ID (pass empty string for the latest run)
Return Type
- ActivityTreeNode[]|error - Ordered array of tree nodes, or an error
getAgentResponse
Gets the latest response produced by a durable agent (a workflow:DurableAgent).
In a multi-turn conversation this is the answer of the most recent turn; it is
available while the agent is still running (e.g. suspended waiting for the next
chat event) as well as after it completes.
Parameters
- agentId string - The agent's workflow ID (from
workflow:run)
getExecutionGraph
function getExecutionGraph(string workflowId, string runId) returns ExecutionGraph|errorDerives a directed execution graph from the workflow history suitable for rendering with D3.js or React Flow. Nodes represent execution steps; edges connect them in the order they were scheduled.
Parameters
- workflowId string - The workflow instance ID
- runId string - The specific run ID (pass empty string for the latest run)
Return Type
- ExecutionGraph|error - Graph with nodes and edges, or an error
getHumanTaskInfo
function getHumanTaskInfo(string taskId) returns HumanTaskInfo|errorReturns detailed info for a single human task, including memo fields. Calls Temporal DescribeWorkflowExecution to read the memo set at task creation.
Parameters
- taskId string - The child workflow ID of the human task (a bare UUID; the kind travels in its memo)
Return Type
- HumanTaskInfo|error - Full task info including title, userRoles, taskInput, and formSchema, or an error
getReviewActivityInfo
function getReviewActivityInfo(string taskId) returns ReviewActivityInfo|errorReturns detailed info for a single review activity, including the failure context,
the activity arguments that triggered the task, and the JSON Schema of the input
accepted by the proceed-with-input decision (formSchema).
Parameters
- taskId string - The child workflow ID of the review activity (a bare UUID; the kind travels in its memo)
Return Type
- ReviewActivityInfo|error - Full review activity info including errorMessage, taskInput, formSchema, and its audience, or an error (including when the ID refers to a human task or any non-review workflow)
getWorkflowHistory
function getWorkflowHistory(string workflowId, string runId) returns HistoryEvent[]|errorReturns all execution history events for a workflow run in chronological order. Each event includes an event-type-specific attribute map suitable for timeline display.
Parameters
- workflowId string - The workflow instance ID
- runId string - The specific run ID (pass empty string for the latest run)
Return Type
- HistoryEvent[]|error - Ordered array of history events, or an error
getWorkflowInfo
function getWorkflowInfo(string workflowId) returns WorkflowExecutionInfo|errorGets current execution info for a workflow without waiting for it to finish. Returns the status, workflow type, and ID.
Parameters
- workflowId string - The workflow ID
Return Type
- WorkflowExecutionInfo|error - Execution info, or an error
getWorkflowInfoForRun
function getWorkflowInfoForRun(string workflowId, string runId) returns WorkflowExecutionInfo|errorGets execution info for a specific run of a workflow, identified by both workflow ID and run ID.
Unlike getWorkflowInfo, this targets the exact run rather than the latest run.
Return Type
- WorkflowExecutionInfo|error - Execution info, or an error
getWorkflowMetadata
function getWorkflowMetadata() returns WorkflowMetadata|errorReturns the workflow metadata document for this program: registered workflow definitions, human tasks, activities, and durable agents, with their JSON schemas. The document is complete at module init — before any workflow has executed — so it is safe to read once at startup and publish to a control plane.
Return Type
- WorkflowMetadata|error - The metadata document, or an error
getWorkflowTaskQueue
function getWorkflowTaskQueue() returns string?Returns the Temporal task queue this program's worker serves, or nil before the worker has registered. The queue is chosen at program startup — worker configuration, not workflow metadata — which is why it is exposed on its own rather than inside the metadata document: a control plane treats it as runtime state, like capabilities. Integrations in one project share a Temporal namespace, so the queue is the only attribute separating one integration's executions from its neighbours'.
Return Type
- string? - The worker's task queue, or nil before the worker has registered
listAllHumanTasks
function listAllHumanTasks(string? status, string? startTimeFrom, string? startTimeTo, string? closeTimeFrom, string? closeTimeTo, string? taskQueue) returns HumanTaskSummary[]|errorLists all human task instances across all parent workflows, with optional filters.
Queries Temporal's visibility API for executions whose workflow TYPE starts with
humantask-. The taskName and parentWorkflowId fields are extracted from the task's
Temporal memo (set when the task was created by awaitHumanTask).
Parameters
- status string? (default ()) - Optional status filter:
PENDING|COMPLETED|FAILED|CANCELED|TERMINATED
- startTimeFrom string? (default ()) - Optional ISO-8601 lower bound on task start time (inclusive)
- startTimeTo string? (default ()) - Optional ISO-8601 upper bound on task start time (inclusive)
- closeTimeFrom string? (default ()) - Optional ISO-8601 lower bound on task close time (inclusive)
- closeTimeTo string? (default ()) - Optional ISO-8601 upper bound on task close time (inclusive)
- taskQueue string? (default ()) - Optional task queue filter: only tasks served by that integration. Omitted, all task queues in the configured namespace are returned
Return Type
- HumanTaskSummary[]|error - Array of human task summaries, or an error
listAllReviewActivities
function listAllReviewActivities(string? status, string? startTimeFrom, string? startTimeTo, string? closeTimeFrom, string? closeTimeTo, string? taskQueue) returns ReviewActivitySummary[]|errorLists all review activity instances across all parent workflows, with optional filters.
Queries Temporal's visibility API for executions whose workflow TYPE starts with
reviewactivity-.
Parameters
- status string? (default ()) - Optional status filter:
PENDING|COMPLETED|FAILED|CANCELED|TERMINATED
- startTimeFrom string? (default ()) - Optional ISO-8601 lower bound on task start time (inclusive)
- startTimeTo string? (default ()) - Optional ISO-8601 upper bound on task start time (inclusive)
- closeTimeFrom string? (default ()) - Optional ISO-8601 lower bound on task close time (inclusive)
- closeTimeTo string? (default ()) - Optional ISO-8601 upper bound on task close time (inclusive)
- taskQueue string? (default ()) - Optional task queue filter; without it, every queue in the configured namespace
Return Type
- ReviewActivitySummary[]|error - Array of review activity summaries, or an error
listPendingHumanTasks
function listPendingHumanTasks(string parentWorkflowId) returns HumanTaskGroup[]|errorReturns the pending human task child workflows started by the given parent workflow,
grouped by task type and sorted alphabetically by task name. Scans the parent's
event history for child workflow start events whose workflow TYPE has the
humantask- prefix (the ID itself is a bare UUID; what a task is travels in its
type and memo).
Parameters
- parentWorkflowId string - The Temporal workflow ID of the parent workflow
Return Type
- HumanTaskGroup[]|error - Array of task groups sorted by task name, or an error
listPendingReviewActivities
function listPendingReviewActivities(string parentWorkflowId) returns ReviewActivitySummary[]|errorReturns pending review activity child workflows started by the given parent workflow,
grouped by task name and sorted alphabetically. Scans the parent's event history for
child workflow start events whose workflow TYPE has the reviewactivity- prefix (the
ID itself is a bare UUID).
Parameters
- parentWorkflowId string - The Temporal workflow ID of the parent workflow
Return Type
- ReviewActivitySummary[]|error - Array of pending review activity summaries, or an error
listResetPoints
function listResetPoints(string workflowId, string runId) returns ResetPoint[]|errorReturns the events this run can be reset to — its workflow-task events — each annotated with the activity-tree nodes that task scheduled. A reset target is a workflow task, so the annotation is what lets a caller see which steps a point re-runs before choosing it.
Parameters
- workflowId string - The workflow instance ID
- runId string - The specific run ID (pass empty string for the latest run)
Return Type
- ResetPoint[]|error - Ordered array of reset points, or an error
listWorkflowDefinitions
function listWorkflowDefinitions() returns WorkflowDefinition[]|errorLists all workflow types registered with this worker, for use in the workflow launcher UI.
Returns one entry per registered workflow function. The inputSchema field is derived at
runtime from the registered workflow function's signature, or () when the workflow takes
no data input.
Return Type
- WorkflowDefinition[]|error - Array of workflow definitions, or an error
listWorkflowInstances
function listWorkflowInstances(string? status, string? workflowType, string? workflowId, string? startedBy, int 'limit, string? pageToken, string? startTimeFrom, string? startTimeTo, string? closeTimeFrom, string? closeTimeTo, string? taskQueue, string? kind) returns WorkflowInstancePage|errorLists workflow instances, excluding human task and review activity children.
Parameters
- status string? (default ()) - Optional status filter:
RUNNING|SUSPENDED|COMPLETED|FAILED|CANCELED|TERMINATED.RUNNINGexcludes suspended workflows;SUSPENDEDreturns only workflows paused via the suspend management API.
- workflowType string? (default ()) - Optional workflow type filter
- workflowId string? (default ()) - Optional workflow ID prefix filter
- startedBy string? (default ()) - Optional starter user ID filter (set via management API
x-user-idwhen started)
- 'limit int (default 20) - Maximum number of results (capped at maxPageSize)
- pageToken string? (default ()) - Opaque continuation token from a prior call
- startTimeFrom string? (default ()) - Optional ISO-8601 lower bound on workflow start time (inclusive)
- startTimeTo string? (default ()) - Optional ISO-8601 upper bound on workflow start time (inclusive)
- closeTimeFrom string? (default ()) - Optional ISO-8601 lower bound on workflow close time (inclusive)
- closeTimeTo string? (default ()) - Optional ISO-8601 upper bound on workflow close time (inclusive)
- taskQueue string? (default ()) - Optional task queue filter; without it, every queue in the configured namespace
- kind string? (default ()) - Optional kind filter:
WORKFLOW,HUMAN_TASK,REVIEW_ACTIVITY,CHILD_WORKFLOWorAGENT. Without it the listing excludes task and review children, as it did before kinds existed. Each summary reports its ownkind, so an unfiltered listing is still self-describing. Filtering needs theWorkflowKindsearch attribute; where the server has none — the in-memory dev server, which supports no custom attributes — the listing comes back unfiltered with a warning rather than failing.
Return Type
- WorkflowInstancePage|error - Paginated list of workflow instance summaries, or an error
reassignTask
function reassignTask(string taskWorkflowId, TaskAudience audience, [string, string...]? callerRoles, string? userId, IdentitySource identitySource) returns error?Reassigns a live task or review: each named audience list replaces the declared one. Only an administrator of the task may ask; the act is recorded in the task's history.
Parameters
- taskWorkflowId string - The task or review id
- audience TaskAudience - The lists to replace:
userRoles,users,excludedUsers,excludedRoles
- callerRoles [string, string...]? (default ()) - Roles held by the caller
- userId string? (default ()) - The caller's user id
- identitySource IdentitySource (default "asserted") -
verifiedwhen the caller's auth layer validated the identity, elseasserted
Return Type
- error? -
()on success, or an error
resetWorkflowExecution
function resetWorkflowExecution(string workflowId, string runId, int eventId, string reason, string reapplyType, string[] reapplyExclude, string identity, string idempotencyKey) returns WorkflowHandle|errorResets a run to a workflow-task event: history up to that point is preserved and everything after it re-executes as a new run of the same workflow ID — including compensation the run already performed, and against the worker's current code.
Parameters
- workflowId string - The workflow instance ID
- runId string - The specific run ID (pass empty string for the latest run)
- eventId int - The workflow-task event to reset to, from
listResetPoints
- reason string - Audit reason recorded with the reset
- reapplyType string -
signal|none|all-eligible
- reapplyExclude string[] - Event categories to withhold from reapply
- identity string - The caller recorded as the reset's identity
- idempotencyKey string (default "") - Identifies the request so a retry is a no-op rather than a second
reset. Pass the request as the caller made it, not what it resolved
to: with
runIdomitted, "latest" names a different run once the first reset has created one. Empty derives a key from the arguments.
Return Type
- WorkflowHandle|error - Handle carrying the unchanged workflow ID and the new run ID, or an error
resumeWorkflow
Resumes a previously suspended workflow by sending a __wf_resume signal.
Parameters
- workflowId string - The workflow ID to resume
Return Type
- error? - An error if the signal cannot be delivered
resumeWorkflowRun
Resumes a specific run of a suspended workflow. Targets the exact runId rather than
the latest run, which is correct when a workflow ID has multiple historical runs.
Return Type
- error? - An error if the signal cannot be delivered
sendDataToWorkflow
Sends a named data event to a running workflow instance, addressing it by ID — the
management-side counterpart of workflow:sendData. The event is durable once accepted,
so an instance that has not reached its wait yet still receives it.
Parameters
- workflowId string - The workflow instance to deliver to
- dataName string - The event name the workflow waits on. Names reserved for framework control
signals (
__-prefixed,taskCompletion,taskDecision) are rejected
- data anydata - The payload
Return Type
- error? - An error if the instance is not running or the signal cannot be delivered
startWorkflowByType
function startWorkflowByType(string workflowType, json? input, string? workflowId, int? timeoutSeconds, string? startedBy) returns WorkflowHandle|errorStarts a new workflow instance by its registered type name.
Parameters
- workflowType string - The registered workflow type (function name)
- input json? - Workflow input as a JSON-compatible value. A durable agent is started with
its
{query, input}envelope:queryis the user turn, andinputis the payload validated against the agent's declaredinputType
- workflowId string? (default ()) - Optional explicit workflow ID; a UUID-v7 is generated if omitted
- timeoutSeconds int? (default ()) - Optional workflow execution timeout in seconds
- startedBy string? (default ()) - Optional starter user ID; stored with workflow metadata for filtering
Return Type
- WorkflowHandle|error - Handle with workflowId and runId, or an error
suspendWorkflow
Requests a running workflow to pause. It stops at its next durable operation and holds there
until resumeWorkflow; while paused its status reads SUSPENDED.
Parameters
- workflowId string - The workflow ID to suspend
Return Type
- error? - An error if the signal cannot be delivered
suspendWorkflowRun
Suspends a specific run of a workflow. Targets the exact runId rather than the
latest run, which is correct when a workflow ID has multiple historical runs.
Parameters
- workflowId string - The workflow ID to suspend
- runId string - The specific run ID to suspend
Return Type
- error? - An error if the signal cannot be delivered
terminateWorkflow
Terminates a running workflow immediately with an optional reason. Unlike cancel, terminate does not allow the workflow to perform cleanup.
Parameters
- workflowId string - The workflow ID to terminate
- runId string - The specific run ID to terminate (pass empty string to use latest run)
- reason string? (default ()) - Optional human-readable reason
Return Type
- error? - An error if the workflow cannot be found or terminated
toErrorJson
function toErrorJson(Error err) returns jsonThe canonical JSON representation of a management error:
{"error": {"message": "..."}}. Every transport serializes errors this way, so
a consumer sees the same payload whichever path the operation was invoked
through.
Parameters
- err Error - The error to represent
Return Type
- json - The error as a
jsonpayload
wakeAgent
Wakes a durable agent instance out of its built-in sleep tool. Harmless when the instance is
not sleeping: the request is consumed by the next sleep.
Parameters
- workflowId string - The agent instance ID to wake
Return Type
- error? - An error if the signal cannot be delivered
Enums
workflow.management: ActivityNodeType
Classification of a node in the activity tree or execution graph. DATA marks
a received data event (workflow:sendData answering a wait dataEvents.<name>).
Members
workflow.management: BulkItemOutcome
What happened to one review activity in a bulk decision.
APPLIED — the decision was submitted.
SKIPPED — the task was not eligible and nothing was submitted: it was already
decided, or it gates a proposed call (PRE_RUN) rather than reviewing a failure.
FAILED — the decision could not be submitted: the task does not exist, the caller
may not decide it, or the runtime rejected it.
Members
workflow.management: ErrorCode
The machine-readable, protocol-independent reason a management operation failed.
One value per Error subtype, so a consumer that carries errors across a
boundary (a wire format, generated code, a log pipeline) can branch on the
reason without doing is-checks against this module's error types — and without
this module knowing anything about the consumer's protocol. Adapters own the
translation: workflow.management.rest maps these to HTTP status codes; other
transports map them to their own vocabulary.
Members
workflow.management: Operation
Names a management operation. The string value of each member is the operation's
stable wire name, so a consumer that receives an operation as text converts it
with cloneWithType/ensureType and gets a compile-time-checked value.
Members
Configurables
workflow.management: maxPageSize
Maximum number of items returned per page in list operations.
workflow.management: maxBulkRetrySize
Maximum number of review activities one bulk decision may address. A selector that resolves to more is rejected rather than truncated, so a caller is never told a decision was applied to a set larger than the one it was applied to.
workflow.management: reviewActivityAccessRole
Optional role required to view or decide review activities that declare no roles of
their own. A failure review declares the roles its retryPolicy names — a role
string, or a list of them — and declares none only when the policy is the legacy
"MANUAL_RETRY" sentinel, which opts out of role restriction. By default (()),
those unrestricted reviews are visible to any caller; set a role name to restrict
them to callers holding that role. Review activities that do declare roles always
require a matching caller role, regardless of this setting.
Records
workflow.management: ActivityInvocation
Information about an activity invocation (for testing/introspection).
Fields
- activityName string - The name of the activity that was invoked
- input anydata[] - The arguments passed to the activity
- output anydata? - The result returned by the activity (nil if not yet completed or failed)
- status string - The status of the activity execution ("COMPLETED", "FAILED", "RUNNING", "PENDING")
- errorMessage string? - Error message if the activity failed
- attempt? int - The attempt number for this invocation (1-based; values greater than 1 indicate a retry)
workflow.management: ActivityMeta
Describes one registered activity for metadata publishing. The input schema backs
review-activity proceed-with-input forms.
Fields
- workflowType string - The workflow definition the activity is registered under
- name string - The activity function name
- inputSchema string? - JSON Schema of the activity's data parameters as a string, or
()when it cannot be derived
workflow.management: ActivityTreeNode
A node in the activity execution tree for a workflow instance.
Fields
- id string - Unique node identifier (Temporal scheduledEventId or initiatedEventId as string)
- name string - Activity, task, or workflow type name
- 'type ActivityNodeType - Node classification
- status string - Current status: RUNNING | WAITING | COMPLETED | FAILED | TIMED_OUT | CANCELED (WAITING marks a data event the workflow is currently blocked on)
- startTime string? - ISO-8601 timestamp when this node started, or
()
- endTime string? - ISO-8601 timestamp when this node ended, or
()if still running
- input anydata? - Decoded activity/workflow input, or
()
- output anydata? - Decoded activity/workflow result, or
()
- failure FailureInfo? - Failure detail if the node failed, otherwise
()
- attempt int - Temporal attempt number (1-indexed)
- stepId string?(default ()) - Which step of the workflow ran: the id chosen with
stepIdat the call site, or the generated<target>#<ordinal>, matching a node in the descriptor'sgraph.()when the execution carries none — an instance started before the runtime recorded it
- reviewStepId string?(default ()) - For a review: its own node in the descriptor graph (
<reviewedStep>#review). Nil for other node kinds
- children ActivityTreeNode[]? - Nested child nodes, or
()for leaf nodes
workflow.management: AgentMeta
Describes one declared durable agent for metadata publishing.
Fields
- name string - The agent name (its module-level variable name)
- events string[] - Declared event channel names
- tools string[] - Tool names advertised to the model (declared activities and tools)
- humanTasks string[] - Qualified names (
<agent>.<task>) of the agent's declared human tasks
workflow.management: BulkItemResult
The outcome of one review activity within a bulk decision.
Fields
- taskId string - Workflow ID of the review activity this outcome belongs to
- outcome BulkItemOutcome - Whether the decision was applied, skipped, or failed
- reason string? - Why, for
SKIPPEDandFAILED;()when the decision was applied
workflow.management: BulkRetryResult
The result of a bulk decision. A bulk decision reports per-task outcomes rather than failing as a whole: one task decided by another operator in the meantime, or one the caller may not decide, does not stop the rest.
Fields
- action BulkRetryAction - The decision applied to every eligible task
- requested int - Number of tasks the selector resolved to
- applied int - Number of tasks the decision was submitted for
- skipped int - Number of tasks that were not eligible
- failed int - Number of tasks the decision could not be submitted for
- items BulkItemResult[] - Per-task outcomes, in the order the tasks were processed
- decidedBy string - User ID of the caller, or
"unknown"when the caller presented none
- decidedAt string - ISO-8601 timestamp of when the bulk decision was processed
workflow.management: Command
A management operation to execute, named by Operation and parameterized by a
map. Parameter names match the operation's own vocabulary and are documented
with executeCommand.
Fields
- operation Operation - The operation to run
- params map<json>(default {}) - The operation's parameters
- identity Identity(default {}) - The caller's identity
workflow.management: CompletionInfo
Audit record returned by human task completion operations.
Fields
- success boolean - Always true on the success path
- completedBy string - User ID extracted from the
x-user-idrequest header
- completedAt string - ISO-8601 timestamp of when the completion was processed
workflow.management: ExecutionGraph
Directed graph representing workflow execution flow for visualization.
Fields
- nodes GraphNode[] - Graph nodes (activities, tasks, timers, signals)
- edges GraphEdge[] - Directed edges connecting nodes in execution order
workflow.management: FailureInfo
A single failure description extracted from a Temporal activity or child-workflow failure.
Fields
- message string - Human-readable failure message
- 'type string? - Application failure type string, or
()if unavailable
- cause string? - Message of the root-cause failure, or
()if no cause chain
workflow.management: GraphEdge
A directed edge in the execution graph.
Fields
- 'source string - Source node ID
- target string - Target node ID
- label string? - Optional edge label
workflow.management: GraphNode
A node in the execution graph.
Fields
- id string - Unique node identifier
- label string - Display label
- 'type ActivityNodeType - Node classification (same values as
ActivityNodeType)
- status string - Current status
- metadata map<json>? - Optional extra key-value pairs for the UI:
taskIdfor human tasks, andstepId— which step ran, for highlighting the descriptor's graph
workflow.management: HistoryEvent
A single event from the Temporal workflow execution history.
Fields
- eventId int - Monotonically increasing event sequence number
- eventType string - Temporal event type name (e.g.
ACTIVITY_TASK_SCHEDULED)
- timestamp string - ISO-8601 wall-clock timestamp of the event
- attributes map<json> - Event-type-specific attribute map
workflow.management: HumanTaskGroup
Groups human task instances by task type for a single parent workflow.
Fields
- taskName string - The task type name (the
taskNamepassed toawaitHumanTask)
- taskIds string[] - Child workflow IDs of pending instances of this task type, in the order they were started
workflow.management: HumanTaskInfo
Detailed info about a human task, including memo fields set at task creation.
Fields
- Fields Included from *TaskInfo
- createdAt string
- formSchema string|()
- kind string
- taskId string
- taskName string
- title string
- description string
- namespace string
- taskQueue string
- parentWorkflowId string
- parentWorkflowType string|()
- stepId string|()
- status string
- startTime string
- closeTime string|()
- userRoles string[]
- users string[]
- excludedUsers string[]
- excludedRoles string[]
- administratorRoles string[]
- administratorUsers string[]
- completedBy string|()
- completedAt string|()
- completedAs string|()
- canComplete boolean
- canAdminister boolean
- taskInput map<json>? - Read-only context map rendered alongside the form
- result json? - The value submitted when completing the task, or
()if not yet completed
workflow.management: HumanTaskMeta
Describes one human task type for metadata publishing.
Fields
- name string - Qualified task name (
<workflowType>.<taskName>)
- resultSchema string? - JSON Schema of the task's completion form as a string, or
()when the result type is not yet known in this process (it is registered at module init when the compiler plugin can determine it statically, and lazily at first execution otherwise)
workflow.management: HumanTaskPage
Paginated list of human task summaries.
Fields
- items HumanTaskSummary[] - Human task summaries for this page
- nextPageToken string? - Opaque continuation token, or
()on the last page
- hasMore boolean - True when more pages follow
workflow.management: HumanTaskSummary
Summary of a human task instance for list views.
Fields
- Fields Included from *TaskSummary
- kind string
- taskId string
- taskName string
- title string
- description string
- namespace string
- taskQueue string
- parentWorkflowId string
- parentWorkflowType string|()
- stepId string|()
- status string
- startTime string
- closeTime string|()
- userRoles string[]
- users string[]
- excludedUsers string[]
- excludedRoles string[]
- administratorRoles string[]
- administratorUsers string[]
- completedBy string|()
- completedAt string|()
- completedAs string|()
- canComplete boolean
- canAdminister boolean
workflow.management: Identity
Identity of the caller an operation runs on behalf of. Drives role-based
visibility, task-completion authorization, and the audit fields recorded on
completions and decisions (completedBy, decidedBy, startedBy).
Fields
- userId string?(default ()) - The caller's user ID, or
()when unknown
- roles string[](default []) - The caller's roles; an empty array means the caller holds none
- identitySource IdentitySource(default "asserted") -
verifiedwhen resolved from a credential the caller's auth layer validated;asserted(the default) when supplied as given
workflow.management: ResetPoint
An event a run can be reset to, and what resetting there re-runs.
Fields
- eventId int - Workflow-task event ID to reset to
- eventType string - The eligible workflow-task event:
WORKFLOW_TASK_COMPLETED,WORKFLOW_TASK_FAILED, orWORKFLOW_TASK_TIMED_OUT
- timestamp string - ISO-8601 time of the event
- nodeIds string[] - Activity-tree node IDs this task scheduled — all of them re-execute together. Empty when the task scheduled no visible work.
- nodeNames string[] - Display names for
nodeIds, in the same order
- isFirstFailure boolean - True for the point that re-runs the run's first failed step — the default "retry from where it broke"
workflow.management: ResetReapply
Which post-reset events are re-delivered to the new run.
Fields
- 'type "signal"|"none"|"all-eligible" (default "signal") -
"signal"re-delivers signals (the engine default),"none"re-delivers nothing, and"all-eligible"also re-delivers updates. Durable agent turns arrive as updates, so an agent reset with"signal"replays the agent without its conversation.
- exclude ("signal"|"update"|"nexus"|"cancel-request")[](default []) - Event categories to withhold even when
'typewould re-deliver them
workflow.management: ReviewActivityInfo
Detailed info about a review activity, including the proposal or failure context.
Fields
- Fields Included from *TaskInfo
- createdAt string
- formSchema string|()
- kind string
- taskId string
- taskName string
- title string
- description string
- namespace string
- taskQueue string
- parentWorkflowId string
- parentWorkflowType string|()
- stepId string|()
- status string
- startTime string
- closeTime string|()
- userRoles string[]
- users string[]
- excludedUsers string[]
- excludedRoles string[]
- administratorRoles string[]
- administratorUsers string[]
- completedBy string|()
- completedAt string|()
- completedAs string|()
- canComplete boolean
- canAdminister boolean
- activityName string - Fully-qualified name of the reviewed activity
- trigger string - Why the review was created:
PRE_RUN(approval gate) |ON_FAILURE(rerun decision)
- errorMessage string - Error message from the failed activity invocation (empty for a pre-run gate)
- taskInput map<json>? - Arguments proposed for (or passed to) the activity invocation; use these to
pre-fill the
formSchemaform
- decision ReviewDecision? - The decision recorded, or
()while pending
workflow.management: ReviewActivityPage
Paginated list of review activity summaries.
Fields
- items ReviewActivitySummary[] - Review activity summaries for this page
- nextPageToken string? - Opaque continuation token, or
()on the last page
- hasMore boolean - True when more pages follow
workflow.management: ReviewActivitySummary
Summary of a review activity instance for list views.
Fields
- Fields Included from *TaskSummary
- kind string
- taskId string
- taskName string
- title string
- description string
- namespace string
- taskQueue string
- parentWorkflowId string
- parentWorkflowType string|()
- stepId string|()
- status string
- startTime string
- closeTime string|()
- userRoles string[]
- users string[]
- excludedUsers string[]
- excludedRoles string[]
- administratorRoles string[]
- administratorUsers string[]
- completedBy string|()
- completedAt string|()
- completedAs string|()
- canComplete boolean
- canAdminister boolean
- activityName string - Fully-qualified name of the reviewed activity (
workflowType.activityName)
- trigger string - Why the review was created:
PRE_RUN(approval gate) |ON_FAILURE(rerun decision)
workflow.management: ReviewDecision
Decision submitted by a human to resolve a review activity — a proposed activity call awaiting approval before it runs, or a failed activity awaiting a rerun decision.
Fields
- action "proceed"|"proceed-with-input"|"reject" -
"proceed"runs (or reruns) the activity with the original arguments;"proceed-with-input"runs it with theinputmap overriding arguments;"reject"skips the activity: the proposed call is not made, or the original failure is surfaced back to the workflow.
- input map<anydata>?(default ()) - New named arguments for the activity. Only relevant when
actionis"proceed-with-input". Keys must match the activity's parameter names.
- feedback string?(default ()) - Optional reviewer note. On
"reject"it is relayed to the caller so the workflow can act on it (e.g. surface it in the failure message).
workflow.management: ReviewDecisionInfo
Audit record returned by review activity decision operations.
Fields
- success boolean - Always true on the success path
- decision string - The decision taken:
"proceed","proceed-with-input", or"reject"
- completedBy string - User ID extracted from the
x-user-idrequest header
- completedAt string - ISO-8601 timestamp of when the decision was processed
workflow.management: TaskAdministration
Audit record returned by the administer operations.
Fields
- success boolean - Always true on the success path
- action string -
reassignorextendDeadline
- administeredBy string - User ID extracted from the
x-user-idrequest header
- administeredAt string - ISO-8601 timestamp of when the act was processed
workflow.management: TaskAudience
The audience an administrator gives a live task. Each present list replaces the one the task was created with; an absent one is left as it was. Administrators themselves cannot be changed.
Fields
- userRoles? string[] - Roles that may act
- users? string[] - User ids that may act
- excludedUsers? string[] - User ids that may not act
- excludedRoles? string[] - Roles that may not act
workflow.management: TaskInfo
What every task instance reports in detail, on top of its summary.
Fields
- Fields Included from *TaskSummary
- kind string
- taskId string
- taskName string
- title string
- description string
- namespace string
- taskQueue string
- parentWorkflowId string
- parentWorkflowType string|()
- stepId string|()
- status string
- startTime string
- closeTime string|()
- userRoles string[]
- users string[]
- excludedUsers string[]
- excludedRoles string[]
- administratorRoles string[]
- administratorUsers string[]
- completedBy string|()
- completedAt string|()
- completedAs string|()
- canComplete boolean
- canAdminister boolean
- createdAt string - ISO-8601 timestamp stored in memo at task start
- formSchema string? - JSON Schema for the completion form (populated by compiler plugin;
()until then)
workflow.management: TaskSummary
What every task instance reports in a list, whichever kind it is: identity, where it came from, who may act on it, and who did.
Fields
- kind string -
HUMAN_TASKorREVIEW_ACTIVITY
- taskId string - Child workflow ID of this task instance (a bare UUID; the kind travels in its memo)
- taskName string - Qualified task name (
workflowDefinition.taskOrActivityName)
- title string(default "") - Display title given at creation, falling back to the task name when none was set
- description string(default "") - Supporting context shown with the form or decision
- namespace? string - The Temporal namespace the task lives in (the project scope)
- taskQueue? string - The task queue of the integration serving this task; route mutations there
- parentWorkflowId string - Workflow ID of the parent that created this task
- parentWorkflowType string?(default ()) - Registered workflow type of the parent, or
()if not available
- stepId string?(default ()) - The call site that created the task, or
()when the parent did not name it
- status string - Current status, mirroring the underlying task workflow:
PENDING(awaiting a human) |COMPLETED(a human submitted a result or decision) |FAILED(rejected via the fail operation, or timed out before anyone acted) |CANCELED(retired internally because the parent workflow closed) |TERMINATED(an admin terminated the task workflow)
- startTime string - ISO-8601 timestamp when the task was created
- closeTime string? - ISO-8601 timestamp when the task ended, or
()if still pending
- userRoles string[](default []) - Roles permitted to act on this task
- users string[](default []) - User ids permitted to act on it, whatever their roles
- excludedUsers string[](default []) - User ids that may not act on it
- excludedRoles string[](default []) - Roles that may not act on it
- administratorRoles string[](default []) - Roles that administer it: see it, reassign it, move its deadline, fail or complete it
- administratorUsers string[](default []) - User ids that administer it
- completedBy string?(default ()) - User ID of whoever completed, rejected or decided it, or
()while pending. Also()for tasks decided before the completer was recorded on the row
- completedAt string?(default ()) - When that decision was recorded, or
()when unknown
- completedAs string?(default ()) -
audiencewhen someone it was assigned to completed it,administratorwhen an administrator stepped in;()while pending or for tasks decided before 0.10
- canComplete boolean(default false) - Whether the requesting caller may act on it (administrators may)
- canAdminister boolean(default false) - Whether the requesting caller administers it
workflow.management: WorkflowDefinition
Describes a registered workflow type for use by the workflow launcher UI.
Fields
- workflowType string - Registered workflow function name (Temporal workflow type)
- kind string(default "WORKFLOW") - What the definition starts: a
@workflow:Workflowfunction (WORKFLOW) or aworkflow:DurableAgentdeclaration (AGENT). Both start through the same endpoint and list as one set of definitions
- inputSchema string? - JSON Schema of the start input for form rendering: a workflow's
input parameters, or — for an agent — the uniform
{query, input}start envelope, whereinputcarries the declaredinputType's own schema and is absent when the agent declares no payload.()when the schema is unavailable
- isActive boolean - Whether this workflow type has an active registered worker
- workerCount int - Number of workers currently registered for this workflow type
workflow.management: WorkflowDefinitionMeta
Describes one registered workflow definition for metadata publishing.
Fields
- workflowType string - Registered workflow function (or durable agent) name
- kind string -
WORKFLOWfor a@workflow:Workflowfunction,AGENTfor a durable agent
- inputSchema string? - JSON Schema of the workflow's input type as a string, or
()when the workflow takes no data input
workflow.management: WorkflowExecutionInfo
Information about a workflow execution (for testing/introspection).
Fields
- workflowId string - The unique identifier for the workflow instance
- workflowType string - The type (process name) of the workflow
- status string - The execution status ("RUNNING", "SUSPENDED", "COMPLETED", "FAILED", "CANCELED", "TERMINATED"). "SUSPENDED" is a running workflow paused via the suspend management API.
- kind string?(default ()) - What this instance is — WORKFLOW, AGENT, HUMAN_TASK, REVIEW_ACTIVITY or CHILD_WORKFLOW — from the memo its starter stamped. A consumer routes to the right view by asking this, never by parsing the id; nil only for instances started before the stamp existed.
- result anydata? - The workflow result if completed successfully
- errorMessage string? - Error message if the workflow failed
- activityInvocations ActivityInvocation[] - List of activities invoked by this workflow
workflow.management: WorkflowHandle
Handle returned when a new workflow is started.
Fields
- workflowId string - Unique ID of the started workflow instance
- runId string - Temporal run ID
workflow.management: WorkflowInstancePage
Paginated list of workflow instances.
Fields
- items WorkflowInstanceSummary[] - Workflow summaries for this page
- nextPageToken string? - Opaque token to fetch the next page, or
()on the last page
- hasMore boolean - True when more pages follow
workflow.management: WorkflowInstanceSummary
Summary of a workflow instance for list views.
Fields
- namespace? string - The Temporal namespace the task lives in (the project scope)
- taskQueue? string - The task queue of the integration serving this task; route mutations there
- workflowId string - Unique workflow instance ID
- runId string - Temporal run ID for this execution
- workflowType string - Registered workflow type name
- status string - Execution status: RUNNING | SUSPENDED | COMPLETED | FAILED | CANCELED | TERMINATED | TIMED_OUT. SUSPENDED is a running workflow paused via the suspend management API.
- startTime string - ISO-8601 timestamp when the workflow started
- closeTime string? - ISO-8601 timestamp when it ended, or
()if still running
- kind string?(default ()) - What this instance is — WORKFLOW, AGENT, HUMAN_TASK, REVIEW_ACTIVITY, CHILD_WORKFLOW — from the memo its starter stamped (ids carry no classification)
- input json? - Workflow input as JSON, or
()if not available
workflow.management: WorkflowMetadata
The workflow metadata document: everything the program registered with the workflow runtime, complete at module init.
Fields
- metadataVersion string - Version of this document's shape (currently
"1.0")
- definitions WorkflowDefinitionMeta[] - Registered workflow definitions
- humanTasks HumanTaskMeta[] - Human task types with completion-form schemas
- activities ActivityMeta[] - Registered activities with input schemas
- reviewActions string[] - The static review-activity decision vocabulary
- agents AgentMeta[] - Declared durable agents
- descriptor json?(default ()) - The build-time Workflow Definition Descriptor (
workflow.def.json) packed into the running program by the compiler plugin: the canonical, versioned, checksummed description of the same structures with embedded JSON Schemas.()when the program was built without one (older plugin, or a run that never produced an executable JAR, such asbal test)
workflow.management: WorkItemPage
One page of the unified work queue.
Fields
- items WorkItemSummary[] - The page of work items
- nextPageToken string? - Cursor for the next page, or
()on the last one
- hasMore boolean - Whether more items exist past this page
workflow.management: WorkItemSummary
One item of a person's unified work queue: a human task, or a review activity — which is a human task with a fixed decision contract. The kinds stay distinct (each opens its own UX); what they share is the queue and its filters.
Fields
- Fields Included from *TaskSummary
- kind string
- taskId string
- taskName string
- title string
- description string
- namespace string
- taskQueue string
- parentWorkflowId string
- parentWorkflowType string|()
- stepId string|()
- status string
- startTime string
- closeTime string|()
- userRoles string[]
- users string[]
- excludedUsers string[]
- excludedRoles string[]
- administratorRoles string[]
- administratorUsers string[]
- completedBy string|()
- completedAt string|()
- completedAs string|()
- canComplete boolean
- canAdminister boolean
- trigger string?(default ()) - Reviews only:
PRE_RUN(approval gate) |ON_FAILURE(rerun decision)
Errors
workflow.management: AccessDeniedError
The caller lacks the roles required to see or act on the target.
workflow.management: ConflictError
The target exists but is not in a state that allows the operation — for example completing a task that has already been completed.
workflow.management: Error
A management operation failed. Every error returned by an operation belongs to one of the distinct subtypes below, so consumers can branch on the reason without parsing messages.
workflow.management: ExecutionError
The operation could not be completed because of a failure inside the workflow runtime or its backing service.
workflow.management: InvalidPayloadError
The request is well formed, but the payload does not match the type the target declared (e.g. a human task completion value that is not assignable to the task's result type).
workflow.management: InvalidRequestError
The request is malformed: a required parameter is missing, or a value is not of the expected shape.
workflow.management: NotFoundError
The addressed workflow, human task, or review activity does not exist.
Union types
workflow.management: BulkRetryAction
BulkRetryAction
What to do with each review activity in a bulk decision.
"retry" reruns the activity with its original arguments (the single-task
proceed decision); "fail" surfaces the original failure to the workflow (the
single-task reject decision).
workflow.management: ResetTypeName
ResetTypeName
Which point of a run to reset to.
"first-workflow-task" replays the run from its first workflow task, so it runs
again from the beginning with the input it started with. "last-workflow-task"
resets to the most recent workflow task, which is how a run wedged on a failing
workflow task is moved onto fixed code. "workflow-task-id" targets one point
from listResetPoints, which is how a caller starts from a selected step.
Simple name reference types
workflow.management: IdentitySource
IdentitySource
Where a decision's user identity came from, as recorded on its audit entry and span.
Import
import ballerina/workflow.management;Metadata
Released date: 5 days ago
Version: 0.10.0
License: Apache-2.0
Compatibility
Platform: java21
Ballerina version: 2201.13.6
GraalVM compatible: No
Pull count
Total: 10919
Current verison: 418
Weekly downloads
Keywords
workflow
Type/Library
Contributors