# AutomationRunService

> The AutomationRunService methods and their request and response messages.

Source: https://engramsfactory.com/docs/api/automation-run/

Generated from [`automation.proto`](https://github.com/cortexapps/engrams/blob/main/crates/engram-protocol/proto/engram/app/v1/automation.proto). Every method is
`POST /rpc/engram.app.v1.AutomationRunService/<Method>` with a JSON or protobuf body and an
`x-api-key` header.

## Methods

| Method | Request | Response |
|---|---|---|
| `ListRuns` | [`ListRunsRequest`](#listrunsrequest) | [`ListRunsResponse`](#listrunsresponse) |
| `ListInstances` | [`ListInstancesRequest`](#listinstancesrequest) | [`ListInstancesResponse`](#listinstancesresponse) |
| `GetInstance` | [`GetInstanceRequest`](#getinstancerequest) | [`GetInstanceResponse`](#getinstanceresponse) |
| `CloseInstance` | [`CloseInstanceRequest`](#closeinstancerequest) | [`CloseInstanceResponse`](#closeinstanceresponse) |
| `ListRecentDrops` | [`ListRecentDropsRequest`](#listrecentdropsrequest) | [`ListRecentDropsResponse`](#listrecentdropsresponse) |
| `GetRun` | [`GetRunRequest`](#getrunrequest) | [`GetRunResponse`](#getrunresponse) |
| `StopRun` | [`StopRunRequest`](#stoprunrequest) | [`StopRunResponse`](#stoprunresponse) |
| `RetryRun` | [`RetryRunRequest`](#retryrunrequest) | [`RetryRunResponse`](#retryrunresponse) |

## Messages

### AutomationDropBrief

| Field | Type |
|---|---|
| `entrypoint_id` | `string` |
| `event_key` | `string` |
| `reason` | `string` |
| `detail` | `string` |
| `dropped_at` | `string` |

### AutomationInstance

| Field | Type |
|---|---|
| `id` | `string` |
| `automation_id` | `string` |
| `key` | `string` |
| `status` | `string` |
| `inputs_json` | `string` |
| `opened_by` | `string` |
| `opened_at` | `string` |
| `closed_at` | `string` (optional) |
| `close_reason` | `string` (optional) |
| `label` | `string` (optional) |

### AutomationRun

| Field | Type |
|---|---|
| `brief` | [`AutomationRunBrief`](#automationrunbrief) |
| `trigger_json` | `string` |
| `steps` | repeated [`AutomationStepRun`](#automationsteprun) |
| `session_ids` | repeated `string` |

### AutomationRunBrief

| Field | Type |
|---|---|
| `id` | `string` |
| `automation_id` | `string` |
| `version` | `int32` |
| `status` | `string` |
| `error` | `string` (optional) |
| `trigger_source` | `string` |
| `event_key` | `string` (optional) |
| `delivery_key` | `string` (optional) |
| `dry_run` | `bool` |
| `started_at` | `string` (optional) |
| `ended_at` | `string` (optional) |
| `created_at` | `string` |
| `instance_id` | `string` |
| `entrypoint_id` | `string` |

### AutomationStepRun

| Field | Type |
|---|---|
| `block_id` | `string` |
| `attempt` | `int32` |
| `status` | `string` |
| `inputs_json` | `string` |
| `outputs_json` | `string` |
| `error` | `string` (optional) |
| `session_id` | `string` (optional) |
| `started_at` | `string` |
| `ended_at` | `string` (optional) |

### CloseInstanceRequest

| Field | Type |
|---|---|
| `id` | `string` |
| `reason` | `string` (optional) |

### CloseInstanceResponse

| Field | Type |
|---|---|
| `closed` | `bool` |

### FilteredWindow

| Field | Type |
|---|---|
| `count` | `int32` |
| `first_at` | `string` |
| `last_at` | `string` |
| `before_run_id` | `string` |

### GetInstanceRequest

| Field | Type |
|---|---|
| `id` | `string` |

### GetInstanceResponse

| Field | Type |
|---|---|
| `instance` | [`AutomationInstance`](#automationinstance) |
| `handles` | repeated [`InstanceHandle`](#instancehandle) |

### GetRunRequest

| Field | Type |
|---|---|
| `run_id` | `string` |

### GetRunResponse

| Field | Type |
|---|---|
| `run` | [`AutomationRun`](#automationrun) |

### InstanceHandle

| Field | Type |
|---|---|
| `handle` | `string` |
| `written_by` | `string` |
| `created_at` | `string` |

### ListInstancesRequest

| Field | Type |
|---|---|
| `automation_id` | `string` |
| `include_closed` | `bool` |
| `limit` | `int32` |

### ListInstancesResponse

| Field | Type |
|---|---|
| `instances` | repeated [`AutomationInstance`](#automationinstance) |

### ListRecentDropsRequest

| Field | Type |
|---|---|
| `automation_id` | `string` |
| `limit` | `int32` |

### ListRecentDropsResponse

| Field | Type |
|---|---|
| `drops` | repeated [`AutomationDropBrief`](#automationdropbrief) |

### ListRunsRequest

| Field | Type |
|---|---|
| `automation_id` | `string` |
| `limit` | `int32` |
| `include_filtered` | `bool` |
| `instance_id` | `string` (optional) |

### ListRunsResponse

| Field | Type |
|---|---|
| `runs` | repeated [`AutomationRunBrief`](#automationrunbrief) |
| `filtered` | repeated [`FilteredWindow`](#filteredwindow) |

### RetryRunRequest

| Field | Type |
|---|---|
| `run_id` | `string` |
| `from_step_id` | `string` (optional) |

### RetryRunResponse

| Field | Type |
|---|---|
| `run_id` | `string` |

### StopRunRequest

| Field | Type |
|---|---|
| `run_id` | `string` |
| `reason` | `string` (optional) |

### StopRunResponse

| Field | Type |
|---|---|
| `sent` | `bool` |
