# Execute Sommatic App

> Requests a user to interact with a specific Sommatic AI App UI.

Source: https://docs.sommatic.ai/en/nodes/sommatic.app.execute/

- Slug: `sommatic.app.execute`
- Family: Human in the loop
- Version: 1.0.0
- Status: Partial. Creates the app interaction in the backend, then returns `__signal: 'SUSPEND'`, which the execution engine never processes: the workflow does not wait for the app output and continues through the default port.
- Execution: async

Requests a user to interact with a specific Sommatic AI App UI.

## Configuration

- `app_identifier` (string, required): Slug or ID of the frontend app/micro-frontend
- `assignee` (string, optional)
- `timeout_ms` (integer, optional): Default: `3600000`.
- `configuration` (object, optional): Props or context passed to the UI app

Its configuration shows the shared execution settings, but this node does not apply retries (`retryOnFail`, `maxTries`) yet. `continueOnFail` is not applied by any node.

## Output ports

- `completed` (default): Interaction completed
- `timeout`: Interaction expired
- `error`: Error

## Input contract

- `app_identifier` (string, optional)
- `assignee` (string, optional)
- `timeout_ms` (integer, optional)
- `configuration` (object, optional)

## Output contract

- `result` (object, optional)
- `status` (string, optional)

## In expressions

What a later node can read from this node's output with `$("Execute Sommatic App").item.json.<path>`, as the workflow editor suggests it under Previous Nodes (the output contract).

- `$("Execute Sommatic App").item.json.result` (object)
- `$("Execute Sommatic App").item.json.status` (string)


## How it works

Partial. Asks the backend to create an app interaction and returns a suspend signal that the engine does not process: the run neither waits for the app nor follows `completed` or `timeout`.

1. Resolves the config and merges it over the incoming payload (config wins).
2. Throws when `app_identifier` is missing: the run fails, unless a `flow.try` scope catches it.
3. Posts `{ type: "app_execution", app_identifier, configuration, assignee, expires_in_ms: timeout_ms }` to the backend HITL interactions endpoint; an HTTP failure is rethrown.
4. Returns `{ __signal: "SUSPEND", __metadata: { type: "sommatic_app_interaction", id, resume_on: ["completed", "timeout"] } }`.
5. The envelope has no port, so the engine routes it to `out`, which this node does not declare: edges from `completed` or `timeout` are never followed, the branch ends and the run completes without waiting.

## In a workflow

### Node

```json
{
  "node_id": "node-open-intake",
  "label": "Open intake app",
  "operator_slug": "sommatic.app.execute",
  "operator_version": "1.0.0",
  "config": {
    "app_identifier": "sommatic-structured-intake",
    "assignee": "operator@example.com",
    "timeout_ms": 3600000,
    "configuration": {
      "case_id": "{{ $json.case_id }}"
    }
  }
}
```

### Envelope

```json
{
  "ok": true,
  "port": "out",
  "__signal": "SUSPEND",
  "__metadata": {
    "type": "sommatic_app_interaction",
    "id": "<interaction_id>",
    "resume_on": [
      "completed",
      "timeout"
    ]
  }
}
```

## Output ports (behaviour in the code)

### `completed`

Never emitted.

### `timeout`

Never emitted.

### `error`

Never emitted: failures are thrown and fail the run.

## Behaviour in the code

- `timeout_ms`: Only sent to the backend as `expires_in_ms`; the orchestrator does not enforce it.

## Errors

| Message | Port | Cause and fix |
| --- | --- | --- |
| `Missing 'app_identifier'` | `error` | Thrown. The run fails with `Node <node_id> (sommatic.app.execute) failed: Missing 'app_identifier'`, or goes to the catch node of an enclosing `flow.try`. |
| `Request failed with status code <status>` | `error` | Thrown when the backend rejects the interaction request; same effect as above. |

## Notes and limits

- At review time the Sommatic AI backend exposed no handler for this interaction request, so the call is expected to fail and the run with it. The orchestrator resume operation only accepts `stoneos.industry.apply`.
- For a human step today, use `human.task.create` (task that does not block the run) or `sommatic.app.handoff` (terminal handoff to an app).
- The example envelope shows `ok` and `port` as the engine interprets them; the worker returns only `__signal` and `__metadata`.


## Contracts (JSON Schema)

### All (`*.definition.js`)

```json
{
  "slug": "sommatic.app.execute",
  "name": "Execute Sommatic App",
  "category": "hitl",
  "version": "1.0.0",
  "description": "Requests a user to interact with a specific Sommatic AI App UI.",
  "capabilities": [
    "ui",
    "interactive",
    "human"
  ],
  "config_schema": {
    "type": "object",
    "required": [
      "app_identifier"
    ],
    "properties": {
      "app_identifier": {
        "type": "string",
        "title": "App Identifier",
        "description": "Slug or ID of the frontend app/micro-frontend"
      },
      "assignee": {
        "type": "string",
        "title": "Assignee",
        "ui_widget": "user_picker"
      },
      "timeout_ms": {
        "type": "integer",
        "default": 3600000
      },
      "configuration": {
        "type": "object",
        "title": "App Configuration",
        "description": "Props or context passed to the UI app"
      },
      "execution": {
        "type": "object",
        "title": "Execution Settings",
        "properties": {
          "alwaysOutputData": {
            "type": "boolean",
            "title": "Always Output Data",
            "description": "Always output data, even on error (if configured).",
            "default": false
          },
          "retryOnFail": {
            "type": "boolean",
            "title": "Retry On Fail",
            "description": "Retry the execution if it fails.",
            "default": false
          },
          "maxTries": {
            "type": "integer",
            "title": "Max Retries",
            "description": "Number of retries.",
            "default": 3,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "waitBetweenTries": {
            "type": "integer",
            "title": "Wait Between Retries (ms)",
            "default": 1000,
            "displayOptions": {
              "show": {
                "retryOnFail": [
                  true
                ]
              }
            }
          },
          "continueOnFail": {
            "type": "boolean",
            "title": "Continue On Fail",
            "description": "Do not crash workflow on error.",
            "default": false
          },
          "timeout_ms": {
            "type": "integer",
            "title": "Timeout (ms)",
            "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
            "default": 300000
          }
        }
      }
    }
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "app_identifier": {
        "type": "string"
      },
      "assignee": {
        "type": "string"
      },
      "timeout_ms": {
        "type": "integer"
      },
      "configuration": {
        "type": "object"
      }
    }
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "result": {
        "type": "object"
      },
      "status": {
        "type": "string"
      }
    }
  },
  "ports": [
    {
      "port_id": "completed",
      "label": "Completed",
      "is_default": true,
      "description": "Interaction completed"
    },
    {
      "port_id": "timeout",
      "label": "Timeout",
      "description": "Interaction expired"
    },
    {
      "port_id": "error",
      "label": "Error"
    }
  ],
  "execution_mode": "async",
  "tags": [
    "ui",
    "interactive"
  ],
  "is_stateful": true,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://me.veripass.com/sommatic",
      "logo_url": null
    }
  }
}
```

### config_schema

```json
{
  "type": "object",
  "required": [
    "app_identifier"
  ],
  "properties": {
    "app_identifier": {
      "type": "string",
      "title": "App Identifier",
      "description": "Slug or ID of the frontend app/micro-frontend"
    },
    "assignee": {
      "type": "string",
      "title": "Assignee",
      "ui_widget": "user_picker"
    },
    "timeout_ms": {
      "type": "integer",
      "default": 3600000
    },
    "configuration": {
      "type": "object",
      "title": "App Configuration",
      "description": "Props or context passed to the UI app"
    },
    "execution": {
      "type": "object",
      "title": "Execution Settings",
      "properties": {
        "alwaysOutputData": {
          "type": "boolean",
          "title": "Always Output Data",
          "description": "Always output data, even on error (if configured).",
          "default": false
        },
        "retryOnFail": {
          "type": "boolean",
          "title": "Retry On Fail",
          "description": "Retry the execution if it fails.",
          "default": false
        },
        "maxTries": {
          "type": "integer",
          "title": "Max Retries",
          "description": "Number of retries.",
          "default": 3,
          "displayOptions": {
            "show": {
              "retryOnFail": [
                true
              ]
            }
          }
        },
        "waitBetweenTries": {
          "type": "integer",
          "title": "Wait Between Retries (ms)",
          "default": 1000,
          "displayOptions": {
            "show": {
              "retryOnFail": [
                true
              ]
            }
          }
        },
        "continueOnFail": {
          "type": "boolean",
          "title": "Continue On Fail",
          "description": "Do not crash workflow on error.",
          "default": false
        },
        "timeout_ms": {
          "type": "integer",
          "title": "Timeout (ms)",
          "description": "Max execution time for this node before it is killed, in milliseconds. Honored by long-running operators (e.g. OCR/extraction, inline code). Default 300000 (5 min).",
          "default": 300000
        }
      }
    }
  }
}
```

### input_contract_schema

```json
{
  "type": "object",
  "properties": {
    "app_identifier": {
      "type": "string"
    },
    "assignee": {
      "type": "string"
    },
    "timeout_ms": {
      "type": "integer"
    },
    "configuration": {
      "type": "object"
    }
  }
}
```

### output_contract_schema

```json
{
  "type": "object",
  "properties": {
    "result": {
      "type": "object"
    },
    "status": {
      "type": "string"
    }
  }
}
```

### ports

```json
[
  {
    "port_id": "completed",
    "label": "Completed",
    "is_default": true,
    "description": "Interaction completed"
  },
  {
    "port_id": "timeout",
    "label": "Timeout",
    "description": "Interaction expired"
  },
  {
    "port_id": "error",
    "label": "Error"
  }
]
```
