# Audit

> What Sommatic AI records so you can reconstruct any run. Who started it and from where, which version ran, what each node returned and which port it took, plus deployments from Git and credential use.

Source: https://docs.sommatic.ai/en/security/audit/ (updated 2026-11-26)

When someone asks why a request was routed to the wrong team, or who approved a payment, you need facts, not logs to
grep. Sommatic AI records every run as structured data: the run itself, every node it executed, the version that ran and
where that version came from. You read it in the portal's run results or through the
[Execution API](https://docs.sommatic.ai/en/api/reference/execution.md).

## Per run

Each run has a **flow instance** (its live state) and a **flow instance result** (its summary).

| What                       | Fields                                                                                                                                                                                                                         |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Which workflow and version | `flow_definition_id`, `flow_version_id`, `flow_slug`                                                                                                                                                                           |
| When and how long          | `started_at`, `completed_at`, `duration_ms`                                                                                                                                                                                    |
| Who and from where         | `initiated_by` (the identity that started it, empty for webhook or scheduled runs) and `execution_source`: `source` (for example `studio`, `webhook`, `schedule`, `api`, `command-center`), `app_slug`, `actor`, `intent_text` |
| How it entered             | `trigger_id`, `correlation_id`                                                                                                                                                                                                 |
| How it ended               | status (`completed`, `failed`…), `outcome_label`, `outcome_category`, `error_summary`                                                                                                                                          |
| What it did                | `steps_summary`: one entry per node with `nodeId`, `operatorSlug`, `status`, `port`, `durationMs` and `error`                                                                                                                  |
| How much it cost           | `metrics`, such as the count of nodes that ran and succeeded                                                                                                                                                                   |

Runs started by [`workflow.chain`](https://docs.sommatic.ai/en/nodes/workflow.chain.md) keep the link to their child runs, so you can follow a
case across sub-workflows. In expressions, `$execution.id` is the root id of the whole chain.

## Per node

Every node that runs leaves a **node execution**:

| Field                         | Content                                        |
| ----------------------------- | ---------------------------------------------- |
| `node_id`, `flow_instance_id` | Which node, in which run.                      |
| `status`                      | `success` or `error`.                          |
| `started_at`, `ended_at`      | When it ran.                                   |
| `output_envelope`             | What the node returned.                        |
| `selected_port`               | The port it took, which decided the next edge. |
| `execution_result`            | The node's metadata (`meta` of its envelope).  |
| `error_details`               | The error, when it failed.                     |
| `metrics`                     | Latency.                                       |

The run summary keeps only the final output and the outputs you configure for the workflow; the full output of each
node lives here. Treat access to run records like access to the data
your workflows process, because outputs can contain personal or business data.

## Per deployment

Changes to what runs are recorded too:

- **Published versions.** Each publish creates an immutable flow version (or a knowledge resource version), with an
  optional description.
- **Git Sync.** A synced resource keeps a `git_binding`: repository, branch, environment, key and file, the
  `last_synced_commit` and the `deployed_commit` and `deployed_version`. A version published by Git Sync stores the
  commit and key it came from. See [Preview and apply](https://docs.sommatic.ai/en/git-sync/preview-and-apply.md).

## Credential use

Each time a credential is resolved for a node, Sommatic AI logs the credential id, the organization, the credential type
and the calling service. Rejected resolutions are logged as well. The secret itself is never logged. See
[Credentials](https://docs.sommatic.ai/en/security/credentials.md).

## Tasks

A [task](https://docs.sommatic.ai/en/human-in-the-loop/task-lifecycle.md) records who it was assigned to, who claimed it and when, its SLA and
the output the person submitted. Every change of status goes through an explicit transition.

## Live events

While a run is in progress, `GET /workflow-orchestration/execution/stream` streams its progress over server-sent
events (`node-step-started`, `node-step-completed`), and `GET /work-management/task/stream` streams task changes. Use
them for live views; use the run records above as the audit trail.

> **Tip: Design for audit**
>
> Give nodes descriptive labels, route business decisions through [`flow.if`](https://docs.sommatic.ai/en/nodes/flow.if.md) or
> [`flow.switch`](https://docs.sommatic.ai/en/nodes/flow.switch.md) so the chosen port records the decision, and open a task whenever a decision
> must be attributable to a person.

## Next steps

- [Execution API reference](https://docs.sommatic.ai/en/api/reference/execution.md): Read runs, results and node executions.
- [Credentials](https://docs.sommatic.ai/en/security/credentials.md): Keep secrets out of definitions and logs.
