How it works
- Your server starts a task run, workflow run, or session, and creates a session token via
POST /v2/token - Your frontend mounts
<DeckLiveViewComponent />with the token and the ID - The component attaches to it and renders the live browser (hosted at
live.components.deck.co) - If the run needs input, the component collects it and submits it
- On completion, the component returns the run’s output via
onSuccess
Restrictions
- Attaches to an existing task run, workflow run, or session. It never starts one.
- Exactly one of
taskRunId,workflowRunId, orsessionId. The component attaches to one thing. - Closing the component never cancels the run. To stop it, cancel the task run or cancel the workflow run from your server.
Installation
Quick example
Start a run and create a session token on your server:Client
Session token
The component authenticates with a session token (tk_), the same kind the Auth Component uses, created with POST /v2/token. The same token lifecycle applies. The component polls the run while it’s attached, which keeps the token alive up to its 24-hour limit.
Never pass a secret key (sk_) to the browser. The component rejects anything that isn’t a tk_ token at mount, before it loads the iframe or sends a request.
What to attach to
Pass exactly one. Passing none, or more than one, fails at mount.Attaching at any point
The component reads the run’s current state on attach, so it works whenever it mounts:
Attaching is repeatable. Close the component, create a new token, and mount it again later (on the same device or another) and it picks up wherever the run is. A pending interaction keeps its original 5-minute window, so an end user who opens the component late has whatever time is left.
Session mode
A session is the browser the runs execute in, not a run itself. Attaching to one streams that browser and follows whichever of its task runs is currently live, so an interaction raised by any of them is answerable in the component. The component stays attached until the session itself ends. A run in it finishing doesn’t end it.onSuccess fires when the session completes, and onError fires with the last run’s error if it fails. A run that fails inside the session doesn’t fire onError, and onCancel never fires. A session that times out after 10 minutes with no task running completes, which fires onSuccess.
A session has no result of its own, so result, output, and runtimeMs are all null in onSuccess. Read per-run output from the API instead.
Component props
closeAfterStep and showStepProgress apply to workflow runs. Passing either without workflowRunId fails at mount rather than being silently ignored.
The component does not own its lifecycle. Your app does. When onClose fires, you decide what happens.
Callbacks
onStatusChange, onInteractionRequired, onSuccess, and onCancel carry the run’s identity, so you can correlate with your own records and with Deck-side logs:
onSuccess
Called when the run reaches completed.
For a workflow run, read per-step output from
GET /v2/workflow-runs/{id}.
onStatusChange
Called once on attach with the run’s current status, then on every transition: queued, running, interaction_required, review_required, canceling, completed, failed, canceled. Terminal statuses also fire onSuccess, onError, or onCancel.
onCancel
Called when the run reaches canceled, canceled out of band through the API or the Console. It does not fire when the end user dismisses the component.
onError
type is the error category. code is the machine-readable identifier. message is human-readable and may change. Switch on type and code, not message. See Error handling.
onClose
Called when the end user dismisses the component: the close (X) icon, the Escape key, or the Close button on a result screen.
Interactions
When a run needs something only your end user can supply (an MFA code, a security question, a choice of account), it raises an interaction.
Use
"external" when the person watching must not be the one answering. For example, a support agent following a customer’s run should not be typing that customer’s MFA code.
onInteractionRequired carries the identity fields plus the run’s interaction object (type, message, fields). For a workflow run or session, taskRunId is the run that raised it, which is the run to submit the answer to.
A rejected answer isn’t an error. The component shows the message under the prompt and the end user retries in place.
Workflow runs
PassworkflowRunId to follow a whole workflow run across its steps. A common case is picking up after the Auth Component closes: a later step pauses for MFA, and you mount the Live View Component on the same workflow run so the end user can answer it.
closeAfterStep uses the same step names as the Auth Component, but defaults to "*" (the whole run), since this component usually attaches partway through.
- Statuses.
onStatusChangereports task run statuses, not the workflow run’s own. Apausedworkflow reports the paused step’sinteraction_requiredorreview_required. - Interactions. Any step up to the close step can prompt the end user, inline or
external. - Live view.
taskRunView: "live"follows whichever step is running.
Appearance
The component accepts the sameappearance object as the Auth Component: theme, variables, and layout.
In React, the component renders in a fixed 480px-high frame, and taller content scrolls inside it.
Error handling
All errors surface throughonError with a uniform { type, code, message } shape.
Validation errors
Raised by the component before any network request, from checking the token and the prop combination. These checks don’t run when you embed by URL: an invalid token is only logged to the browser console, and if more than one ID is passed, the component usesworkflowRunId, then sessionId, then taskRunId.
Runtime errors
When the run fails,
onError receives the run’s own error unchanged, the same type, code, and message that GET /v2/task-runs/{id} returns (for example auth_invalid or interaction_timeout). A run that failed without an error reports task_failed.
After any error, the component stops following the run. It doesn’t cancel the run or end the session. Short network drops are retried inside the component and never reach onError. To follow the run again, create a new token and remount.
Embed by URL
For clients that can’t run React, load the component’s URL in aWebView (for example, in a React Native app) or an <iframe> and pass configuration as query parameters:
Configuring via postMessage
Instead of URL parameters, load the bare origin (https://live.components.deck.co/), wait for the READY message, then post an INIT message with the full configuration, the same handshake as the Auth Component:
Receiving results
Without React callbacks, the component delivers results as{ type, payload } messages, through window.ReactNativeWebView.postMessage in a React Native WebView or window.postMessage to the parent of an <iframe>. Switch on type and ignore any you don’t handle: