Interaction flow
The interaction object
When an interaction is required, Deck sets the task run status tointeraction_required and populates the interaction field.
| Field | Description |
|---|---|
type | The kind of challenge the source is presenting: mfa, account_selection, security_question. |
message | Human-readable prompt from the source. Display this to your user. |
fields | Array of inputs to collect. Each field has a name, type, and label. |
Field object
| Field | Type | Description |
|---|---|---|
name | string | Field identifier. Use this as the key in the input object when submitting. |
type | string | Input type (e.g. string). |
label | string | Human-readable label for the field. |
Interaction types
mfa
mfa
A one-time code sent via SMS, email, or authenticator app.Typical fields:
codesecurity_question
security_question
A knowledge-based question set by the user at the source.Typical fields:
answeraccount_selection
account_selection
The source has multiple accounts and the user needs to pick one.Typical fields:
account_idfields array always tells you exactly what to collect. Build your UI from the fields rather than hard-coding for specific types. Sources can introduce new verification methods at any time.
Submitting a response
input object. Each key inside input matches a field name from the interaction. If the interaction has multiple fields, include all of them in a single request.
After you submit, the agent resumes. If the source accepts the input, the operation continues. If the source rejects it (wrong MFA code, for example), Deck may emit another interaction_required with the same or updated prompt so the user can retry.
Timeouts
The timeout window depends on the source and the type of interaction. If no response is submitted before the window closes: The task run status changes tofailed with an interaction_timeout error in the errors array. You need to submit a new run.
Events
Subscribe to these events to react to interactions in real time:| Event | Fired when |
|---|---|
task_run.interaction_required | A task run needs user input to continue execution |
interaction field populated, so your handler has everything it needs to prompt the user without an additional API call.
Multiple interactions
A single operation can require more than one interaction. For example, a source might ask for an MFA code, then follow up with a security question. Each prompt is a separateinteraction_required event with a new interaction object. Handle them sequentially. Each submission may lead to another prompt or to completion.
Error handling
| Scenario | What happens |
|---|---|
| Wrong MFA code | Deck may emit another interaction_required for a retry, or the source may lock the account and the operation fails with auth_invalid |
| Interaction submitted when not required | Returns interaction_not_required |
| Invalid field names or types | Returns interaction_input_invalid |
| Timeout | Operation fails with interaction_timeout |