Overview
The History Service is responsible for:- Managing workflow execution mutable state
- Persisting and retrieving workflow history events
- Coordinating workflow task execution
- Managing activity task lifecycle
- Handling workflow signals and queries
- Executing workflow updates
- Managing child workflow executions
- Coordinating replication across clusters
Service Methods
Workflow Execution Lifecycle
StartWorkflowExecution
Starts a new workflow execution or signals an existing one.UUID of the namespace
Workflow start parameters including workflow_id, workflow_type, task_queue
Information about parent workflow if this is a child workflow
Unique identifier for the workflow execution run
True if a new execution was started, false if existing execution was found
TerminateWorkflowExecution
Terminates a running workflow execution.Namespace UUID
Contains workflow execution identifier and termination reason
Empty response on success
DeleteWorkflowExecution
Deletes a workflow execution.Namespace UUID
Workflow execution to delete
Empty response on success
ResetWorkflowExecution
Resets a workflow execution to a specific point in history.Namespace UUID
Reset parameters including target event ID or reset type
New run ID for the reset execution
DescribeWorkflowExecution
Retrieves detailed information about a workflow execution.Namespace UUID
Contains workflow execution identifier
Execution metadata and current state
List of pending activities
List of pending child workflows
State Management
GetMutableState
Retrieves the mutable state of a workflow execution.Namespace UUID
Workflow execution identifier
Expected next event ID for validation
Workflow execution details
Type of the workflow
Next event ID to be assigned
Token for the current history branch
PollMutableState
Polls for mutable state changes with long polling support.Namespace UUID
Workflow execution identifier
Expected next event ID
Current mutable state if changed
DescribeMutableState
Returns comprehensive mutable state information for debugging.Namespace UUID
Workflow execution identifier
JSON representation of cached state
Mutable state from database
Workflow Task Management
RecordWorkflowTaskStarted
Records that a workflow task has started processing.Namespace UUID
Workflow execution identifier
Event ID of the workflow task scheduled event
Unique request ID for idempotency
Original poll request information
Type of the workflow
Event ID of the started event
Current attempt number
History events for the task
RespondWorkflowTaskCompleted
Records completion of a workflow task with generated commands.Namespace UUID
Contains task token and workflow commands
Information about any new workflow task generated
New activity tasks generated
RespondWorkflowTaskFailed
Records that a workflow task failed.Namespace UUID
Contains task token and failure details
Empty response on success
IsWorkflowTaskValid
Validates if a workflow task is still valid.Namespace UUID
Workflow execution identifier
Scheduled event ID to validate
Whether the task is still valid
Activity Task Management
RecordActivityTaskStarted
Records that an activity task has started.Namespace UUID
Workflow execution identifier
Event ID when activity was scheduled
Unique request ID
The activity scheduled event
Event ID for the started event
Current attempt number
RecordActivityTaskHeartbeat
Records a heartbeat for a running activity.Namespace UUID
Contains task token and heartbeat details
Whether the activity has been requested to cancel
RespondActivityTaskCompleted
Records successful completion of an activity task.Namespace UUID
Contains task token and result
Empty response on success
RespondActivityTaskFailed
Records failure of an activity task.Namespace UUID
Contains task token and failure details
Empty response on success
RespondActivityTaskCanceled
Records cancellation of an activity task.Namespace UUID
Contains task token and cancellation details
Empty response on success
Signals and Queries
SignalWorkflowExecution
Sends a signal to a workflow execution.Namespace UUID
Contains execution identifier, signal name, and input
Empty response on success
SignalWithStartWorkflowExecution
Signals a workflow or starts it if it doesn’t exist.Namespace UUID
Combined signal and start parameters
Run ID of the signaled or started workflow
QueryWorkflow
Executes a query against a workflow execution.Namespace UUID
Contains execution identifier and query details
Result of the query
Query rejection details if rejected
RemoveSignalMutableState
Removes a signal from the mutable state.Namespace UUID
Workflow execution identifier
Request ID of the signal to remove
Workflow Updates
UpdateWorkflowExecution
Executes an update on a workflow execution.Namespace UUID
Update request with update name and arguments
Reference to the update for polling
Update outcome if completed synchronously
PollWorkflowExecutionUpdate
Polls for the result of a workflow update.Namespace UUID
Reference to the update
Update outcome (success or failure)
History Operations
GetWorkflowExecutionHistory
Retrieves workflow execution history.Namespace UUID
Contains execution identifier and pagination parameters
History events
Token for next page
Whether history is from archive
GetWorkflowExecutionHistoryReverse
Retrieves workflow history in reverse order.Namespace UUID
Request parameters
History events in reverse order
Token for next page
GetWorkflowExecutionRawHistoryV2
Retrieves raw history events as encoded blobs.Namespace UUID
Request with pagination parameters
Raw history batches
Pagination token
Replication
ReplicateEventsV2
Replicates history events from another cluster.Namespace UUID
Target workflow execution
Events to replicate
Empty response on success
ReplicateWorkflowState
Replicates complete workflow state.Complete workflow state to replicate
Empty response on success
GetReplicationMessages
Retrieves replication messages for a shard.Tokens indicating last received messages
Source cluster name
Batch of replication tasks
Child Workflow Management
RecordChildExecutionCompleted
Records completion of a child workflow.Namespace UUID of parent workflow
Parent workflow execution
Event ID when child was initiated
Child completion event
Additional Operations
ScheduleWorkflowTask
Schedules a new workflow task.Namespace UUID
Workflow execution identifier
Whether this is the first task
ResetStickyTaskQueue
Resets the sticky task queue for a workflow.Namespace UUID
Workflow execution identifier
Empty response on success
RequestCancelWorkflowExecution
Requests cancellation of a workflow execution.Namespace UUID
Cancellation request details
Empty response on success
Usage Notes
- The History Service is typically called by Frontend Service, not directly by clients
- All operations use namespace UUIDs rather than names for efficiency
- Task tokens encode execution context for idempotent operations
- Long polling is supported for state change operations
- Replication operations are used in multi-cluster deployments