# Run lineage

Run lineage connects related executions. Conversation messages can link to that work, while project-owned runs can execute without a conversation.

```mermaid
flowchart TB
  Conversation[Conversation] --> Message[Message]
  AgentRun[Agent run] -.->|when attached| Message
  AgentRun --> Run[Run]
  WorkflowRun[Workflow run] --> Run
  TaskRun[Task run] --> Run
  Run --> Parent[Parent run]
  Run --> Root[Root run]
  Run --> Event[Run events]
  AgentRun --> Tool[Tool call]
```

## Lineage fields

The REST run response exposes these fields. Other API surfaces may use different field names. See the [run reference](/docs/cloud/rest/api-reference/execution-runs-runs/get-run.md) for the full response.

| Field               | Meaning                                                                                                              |
| ------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `id`                | Canonical run UUID.                                                                                                  |
| `target.type`       | Execution definition type, such as `agent`, `workflow`, or `task`.                                                   |
| `target.id`         | Execution definition ID. May be `null` for a historical run.                                                         |
| `project_id`        | Project containing the run.                                                                                          |
| `conversation_id`   | Associated conversation. Omitted when the run has none.                                                              |
| `input_message_id`  | Conversation message that supplied the input, when present.                                                          |
| `output_message_id` | Conversation message containing the result, when present.                                                            |
| `parent_run_id`     | Immediate parent run. Present only on child runs.                                                                    |
| `root_run_id`       | Top-level ancestor run. Present only on child runs.                                                                  |
| `trigger`           | What directly started the run, when recorded. A scheduled invocation has `type: "schedule"` and the schedule's `id`. |

Optional lineage fields are omitted when unavailable. They are not returned as `null`.

## Reading lineage

Start with the conversation or run ID. Parent and root IDs show related work. Run events show execution history. Access checks apply to each run in the tree.

Saving a message and creating its run are separate operations.
