archastro.platform.v1.resources.automation_runs
1# Copyright (c) 2026 ArchAstro Inc. Licensed under the MIT License. 2# This file is auto-generated by @archastro/sdk-generator. Do not edit. 3# Content hash: ee08edaaa3bf 4 5from __future__ import annotations 6 7from collections.abc import AsyncIterator, Iterator 8from typing import Literal, TypedDict 9 10from ...runtime.http_client import HttpClient, SyncHttpClient 11from ...types.automations import AutomationRun 12from ...types.common import RunJournalPage 13 14 15class AutomationRunStreamEventRunUpdate(TypedDict): 16 event: Literal["run_update"] 17 data: AutomationRun 18 19 20AutomationRunStreamEvent = AutomationRunStreamEventRunUpdate 21 22 23class AsyncAutomationRunResource: 24 def __init__(self, http: HttpClient): 25 self._http = http 26 27 async def get(self, automation_run: str) -> AutomationRun: 28 """ 29 Retrieve an automation run 30 Returns a single automation run by ID. 31 Public v1 path: `GET /api/v1/automation_runs/:automation_run`. 32 Developer app-scoped path (legacy shape, same module): 33 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run`. 34 Any automation type is accepted (`trigger`, `scheduled`, or `invoked`). 35 Resolution is viewer-scoped (AppScope + OrgScope): a run the caller cannot 36 see returns 404. 37 38 Args: 39 automation_run: Automation run ID (`arun_...`). 40 41 Returns: 42 The requested automation run. 43 """ 44 return await self._http.request( 45 f"/api/v1/automation_runs/{automation_run}", 46 response_type=AutomationRun, 47 ) 48 49 async def journal( 50 self, automation_run: str, *, limit: int | None = None, after_cursor: str | None = None 51 ) -> RunJournalPage: 52 """ 53 List an automation run journal 54 Returns durable workflow journal entries for an automation run. 55 Public v1 path: `GET /api/v1/automation_runs/:automation_run/journal`. 56 Developer app-scoped path (legacy shape, same module): 57 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run/journal`. 58 Any automation type is accepted. Resolution is viewer-scoped 59 (AppScope + OrgScope). An authorized run without a journal returns 60 `journal: null` and an empty `data` array with HTTP 200. 61 62 Args: 63 automation_run: Automation run ID (`atr_...`) whose journal to retrieve. 64 limit: Maximum number of entries to return. Defaults to 50; maximum is 100. 65 after_cursor: Opaque cursor from the previous response's `after_cursor` field. 66 67 Returns: 68 Forward-paginated automation run journal entries. 69 """ 70 query: dict[str, object] = {} 71 if limit is not None: 72 query["limit"] = limit 73 if after_cursor is not None: 74 query["after_cursor"] = after_cursor 75 return await self._http.request( 76 f"/api/v1/automation_runs/{automation_run}/journal", 77 query=query, 78 response_type=RunJournalPage, 79 ) 80 81 async def stream(self, automation_run: str) -> AsyncIterator[AutomationRunStreamEvent]: 82 """ 83 Stream automation run status 84 Opens a Server-Sent Events connection that emits a `run_update` event whenever 85 the invoked automation run's status changes, replaying the current status on 86 connect and closing on a terminal status (`completed`, `failed`, `cancelled`) 87 or after the max stream duration. 88 89 Args: 90 automation_run: ID of the invoked automation run. 91 92 Returns: 93 Server-Sent Events stream 94 """ 95 async for event in self._http.stream_sse( 96 f"/api/v1/automation_runs/{automation_run}/stream" 97 ): 98 yield event 99 100 101class AutomationRunResource: 102 def __init__(self, http: SyncHttpClient): 103 self._http = http 104 105 def get(self, automation_run: str) -> AutomationRun: 106 """ 107 Retrieve an automation run 108 Returns a single automation run by ID. 109 Public v1 path: `GET /api/v1/automation_runs/:automation_run`. 110 Developer app-scoped path (legacy shape, same module): 111 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run`. 112 Any automation type is accepted (`trigger`, `scheduled`, or `invoked`). 113 Resolution is viewer-scoped (AppScope + OrgScope): a run the caller cannot 114 see returns 404. 115 116 Args: 117 automation_run: Automation run ID (`arun_...`). 118 119 Returns: 120 The requested automation run. 121 """ 122 return self._http.request( 123 f"/api/v1/automation_runs/{automation_run}", 124 response_type=AutomationRun, 125 ) 126 127 def journal( 128 self, automation_run: str, *, limit: int | None = None, after_cursor: str | None = None 129 ) -> RunJournalPage: 130 """ 131 List an automation run journal 132 Returns durable workflow journal entries for an automation run. 133 Public v1 path: `GET /api/v1/automation_runs/:automation_run/journal`. 134 Developer app-scoped path (legacy shape, same module): 135 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run/journal`. 136 Any automation type is accepted. Resolution is viewer-scoped 137 (AppScope + OrgScope). An authorized run without a journal returns 138 `journal: null` and an empty `data` array with HTTP 200. 139 140 Args: 141 automation_run: Automation run ID (`atr_...`) whose journal to retrieve. 142 limit: Maximum number of entries to return. Defaults to 50; maximum is 100. 143 after_cursor: Opaque cursor from the previous response's `after_cursor` field. 144 145 Returns: 146 Forward-paginated automation run journal entries. 147 """ 148 query: dict[str, object] = {} 149 if limit is not None: 150 query["limit"] = limit 151 if after_cursor is not None: 152 query["after_cursor"] = after_cursor 153 return self._http.request( 154 f"/api/v1/automation_runs/{automation_run}/journal", 155 query=query, 156 response_type=RunJournalPage, 157 ) 158 159 def stream(self, automation_run: str) -> Iterator[AutomationRunStreamEvent]: 160 """ 161 Stream automation run status 162 Opens a Server-Sent Events connection that emits a `run_update` event whenever 163 the invoked automation run's status changes, replaying the current status on 164 connect and closing on a terminal status (`completed`, `failed`, `cancelled`) 165 or after the max stream duration. 166 167 Args: 168 automation_run: ID of the invoked automation run. 169 170 Returns: 171 Server-Sent Events stream 172 """ 173 yield from self._http.stream_sse_sync(f"/api/v1/automation_runs/{automation_run}/stream")
24class AsyncAutomationRunResource: 25 def __init__(self, http: HttpClient): 26 self._http = http 27 28 async def get(self, automation_run: str) -> AutomationRun: 29 """ 30 Retrieve an automation run 31 Returns a single automation run by ID. 32 Public v1 path: `GET /api/v1/automation_runs/:automation_run`. 33 Developer app-scoped path (legacy shape, same module): 34 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run`. 35 Any automation type is accepted (`trigger`, `scheduled`, or `invoked`). 36 Resolution is viewer-scoped (AppScope + OrgScope): a run the caller cannot 37 see returns 404. 38 39 Args: 40 automation_run: Automation run ID (`arun_...`). 41 42 Returns: 43 The requested automation run. 44 """ 45 return await self._http.request( 46 f"/api/v1/automation_runs/{automation_run}", 47 response_type=AutomationRun, 48 ) 49 50 async def journal( 51 self, automation_run: str, *, limit: int | None = None, after_cursor: str | None = None 52 ) -> RunJournalPage: 53 """ 54 List an automation run journal 55 Returns durable workflow journal entries for an automation run. 56 Public v1 path: `GET /api/v1/automation_runs/:automation_run/journal`. 57 Developer app-scoped path (legacy shape, same module): 58 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run/journal`. 59 Any automation type is accepted. Resolution is viewer-scoped 60 (AppScope + OrgScope). An authorized run without a journal returns 61 `journal: null` and an empty `data` array with HTTP 200. 62 63 Args: 64 automation_run: Automation run ID (`atr_...`) whose journal to retrieve. 65 limit: Maximum number of entries to return. Defaults to 50; maximum is 100. 66 after_cursor: Opaque cursor from the previous response's `after_cursor` field. 67 68 Returns: 69 Forward-paginated automation run journal entries. 70 """ 71 query: dict[str, object] = {} 72 if limit is not None: 73 query["limit"] = limit 74 if after_cursor is not None: 75 query["after_cursor"] = after_cursor 76 return await self._http.request( 77 f"/api/v1/automation_runs/{automation_run}/journal", 78 query=query, 79 response_type=RunJournalPage, 80 ) 81 82 async def stream(self, automation_run: str) -> AsyncIterator[AutomationRunStreamEvent]: 83 """ 84 Stream automation run status 85 Opens a Server-Sent Events connection that emits a `run_update` event whenever 86 the invoked automation run's status changes, replaying the current status on 87 connect and closing on a terminal status (`completed`, `failed`, `cancelled`) 88 or after the max stream duration. 89 90 Args: 91 automation_run: ID of the invoked automation run. 92 93 Returns: 94 Server-Sent Events stream 95 """ 96 async for event in self._http.stream_sse( 97 f"/api/v1/automation_runs/{automation_run}/stream" 98 ): 99 yield event
28 async def get(self, automation_run: str) -> AutomationRun: 29 """ 30 Retrieve an automation run 31 Returns a single automation run by ID. 32 Public v1 path: `GET /api/v1/automation_runs/:automation_run`. 33 Developer app-scoped path (legacy shape, same module): 34 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run`. 35 Any automation type is accepted (`trigger`, `scheduled`, or `invoked`). 36 Resolution is viewer-scoped (AppScope + OrgScope): a run the caller cannot 37 see returns 404. 38 39 Args: 40 automation_run: Automation run ID (`arun_...`). 41 42 Returns: 43 The requested automation run. 44 """ 45 return await self._http.request( 46 f"/api/v1/automation_runs/{automation_run}", 47 response_type=AutomationRun, 48 )
Retrieve an automation run
Returns a single automation run by ID.
Public v1 path: GET /api/v1/automation_runs/:automation_run.
Developer app-scoped path (legacy shape, same module):
GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run.
Any automation type is accepted (trigger, scheduled, or invoked).
Resolution is viewer-scoped (AppScope + OrgScope): a run the caller cannot
see returns 404.
Arguments:
- automation_run: Automation run ID (
arun_...).
Returns:
The requested automation run.
50 async def journal( 51 self, automation_run: str, *, limit: int | None = None, after_cursor: str | None = None 52 ) -> RunJournalPage: 53 """ 54 List an automation run journal 55 Returns durable workflow journal entries for an automation run. 56 Public v1 path: `GET /api/v1/automation_runs/:automation_run/journal`. 57 Developer app-scoped path (legacy shape, same module): 58 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run/journal`. 59 Any automation type is accepted. Resolution is viewer-scoped 60 (AppScope + OrgScope). An authorized run without a journal returns 61 `journal: null` and an empty `data` array with HTTP 200. 62 63 Args: 64 automation_run: Automation run ID (`atr_...`) whose journal to retrieve. 65 limit: Maximum number of entries to return. Defaults to 50; maximum is 100. 66 after_cursor: Opaque cursor from the previous response's `after_cursor` field. 67 68 Returns: 69 Forward-paginated automation run journal entries. 70 """ 71 query: dict[str, object] = {} 72 if limit is not None: 73 query["limit"] = limit 74 if after_cursor is not None: 75 query["after_cursor"] = after_cursor 76 return await self._http.request( 77 f"/api/v1/automation_runs/{automation_run}/journal", 78 query=query, 79 response_type=RunJournalPage, 80 )
List an automation run journal
Returns durable workflow journal entries for an automation run.
Public v1 path: GET /api/v1/automation_runs/:automation_run/journal.
Developer app-scoped path (legacy shape, same module):
GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run/journal.
Any automation type is accepted. Resolution is viewer-scoped
(AppScope + OrgScope). An authorized run without a journal returns
journal: null and an empty data array with HTTP 200.
Arguments:
- automation_run: Automation run ID (
atr_...) whose journal to retrieve. - limit: Maximum number of entries to return. Defaults to 50; maximum is 100.
- after_cursor: Opaque cursor from the previous response's
after_cursorfield.
Returns:
Forward-paginated automation run journal entries.
82 async def stream(self, automation_run: str) -> AsyncIterator[AutomationRunStreamEvent]: 83 """ 84 Stream automation run status 85 Opens a Server-Sent Events connection that emits a `run_update` event whenever 86 the invoked automation run's status changes, replaying the current status on 87 connect and closing on a terminal status (`completed`, `failed`, `cancelled`) 88 or after the max stream duration. 89 90 Args: 91 automation_run: ID of the invoked automation run. 92 93 Returns: 94 Server-Sent Events stream 95 """ 96 async for event in self._http.stream_sse( 97 f"/api/v1/automation_runs/{automation_run}/stream" 98 ): 99 yield event
Stream automation run status
Opens a Server-Sent Events connection that emits a run_update event whenever
the invoked automation run's status changes, replaying the current status on
connect and closing on a terminal status (completed, failed, cancelled)
or after the max stream duration.
Arguments:
- automation_run: ID of the invoked automation run.
Returns:
Server-Sent Events stream
102class AutomationRunResource: 103 def __init__(self, http: SyncHttpClient): 104 self._http = http 105 106 def get(self, automation_run: str) -> AutomationRun: 107 """ 108 Retrieve an automation run 109 Returns a single automation run by ID. 110 Public v1 path: `GET /api/v1/automation_runs/:automation_run`. 111 Developer app-scoped path (legacy shape, same module): 112 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run`. 113 Any automation type is accepted (`trigger`, `scheduled`, or `invoked`). 114 Resolution is viewer-scoped (AppScope + OrgScope): a run the caller cannot 115 see returns 404. 116 117 Args: 118 automation_run: Automation run ID (`arun_...`). 119 120 Returns: 121 The requested automation run. 122 """ 123 return self._http.request( 124 f"/api/v1/automation_runs/{automation_run}", 125 response_type=AutomationRun, 126 ) 127 128 def journal( 129 self, automation_run: str, *, limit: int | None = None, after_cursor: str | None = None 130 ) -> RunJournalPage: 131 """ 132 List an automation run journal 133 Returns durable workflow journal entries for an automation run. 134 Public v1 path: `GET /api/v1/automation_runs/:automation_run/journal`. 135 Developer app-scoped path (legacy shape, same module): 136 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run/journal`. 137 Any automation type is accepted. Resolution is viewer-scoped 138 (AppScope + OrgScope). An authorized run without a journal returns 139 `journal: null` and an empty `data` array with HTTP 200. 140 141 Args: 142 automation_run: Automation run ID (`atr_...`) whose journal to retrieve. 143 limit: Maximum number of entries to return. Defaults to 50; maximum is 100. 144 after_cursor: Opaque cursor from the previous response's `after_cursor` field. 145 146 Returns: 147 Forward-paginated automation run journal entries. 148 """ 149 query: dict[str, object] = {} 150 if limit is not None: 151 query["limit"] = limit 152 if after_cursor is not None: 153 query["after_cursor"] = after_cursor 154 return self._http.request( 155 f"/api/v1/automation_runs/{automation_run}/journal", 156 query=query, 157 response_type=RunJournalPage, 158 ) 159 160 def stream(self, automation_run: str) -> Iterator[AutomationRunStreamEvent]: 161 """ 162 Stream automation run status 163 Opens a Server-Sent Events connection that emits a `run_update` event whenever 164 the invoked automation run's status changes, replaying the current status on 165 connect and closing on a terminal status (`completed`, `failed`, `cancelled`) 166 or after the max stream duration. 167 168 Args: 169 automation_run: ID of the invoked automation run. 170 171 Returns: 172 Server-Sent Events stream 173 """ 174 yield from self._http.stream_sse_sync(f"/api/v1/automation_runs/{automation_run}/stream")
106 def get(self, automation_run: str) -> AutomationRun: 107 """ 108 Retrieve an automation run 109 Returns a single automation run by ID. 110 Public v1 path: `GET /api/v1/automation_runs/:automation_run`. 111 Developer app-scoped path (legacy shape, same module): 112 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run`. 113 Any automation type is accepted (`trigger`, `scheduled`, or `invoked`). 114 Resolution is viewer-scoped (AppScope + OrgScope): a run the caller cannot 115 see returns 404. 116 117 Args: 118 automation_run: Automation run ID (`arun_...`). 119 120 Returns: 121 The requested automation run. 122 """ 123 return self._http.request( 124 f"/api/v1/automation_runs/{automation_run}", 125 response_type=AutomationRun, 126 )
Retrieve an automation run
Returns a single automation run by ID.
Public v1 path: GET /api/v1/automation_runs/:automation_run.
Developer app-scoped path (legacy shape, same module):
GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run.
Any automation type is accepted (trigger, scheduled, or invoked).
Resolution is viewer-scoped (AppScope + OrgScope): a run the caller cannot
see returns 404.
Arguments:
- automation_run: Automation run ID (
arun_...).
Returns:
The requested automation run.
128 def journal( 129 self, automation_run: str, *, limit: int | None = None, after_cursor: str | None = None 130 ) -> RunJournalPage: 131 """ 132 List an automation run journal 133 Returns durable workflow journal entries for an automation run. 134 Public v1 path: `GET /api/v1/automation_runs/:automation_run/journal`. 135 Developer app-scoped path (legacy shape, same module): 136 `GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run/journal`. 137 Any automation type is accepted. Resolution is viewer-scoped 138 (AppScope + OrgScope). An authorized run without a journal returns 139 `journal: null` and an empty `data` array with HTTP 200. 140 141 Args: 142 automation_run: Automation run ID (`atr_...`) whose journal to retrieve. 143 limit: Maximum number of entries to return. Defaults to 50; maximum is 100. 144 after_cursor: Opaque cursor from the previous response's `after_cursor` field. 145 146 Returns: 147 Forward-paginated automation run journal entries. 148 """ 149 query: dict[str, object] = {} 150 if limit is not None: 151 query["limit"] = limit 152 if after_cursor is not None: 153 query["after_cursor"] = after_cursor 154 return self._http.request( 155 f"/api/v1/automation_runs/{automation_run}/journal", 156 query=query, 157 response_type=RunJournalPage, 158 )
List an automation run journal
Returns durable workflow journal entries for an automation run.
Public v1 path: GET /api/v1/automation_runs/:automation_run/journal.
Developer app-scoped path (legacy shape, same module):
GET /protected/api/v1/developer/apps/:app/automations/runs/:automation_run/journal.
Any automation type is accepted. Resolution is viewer-scoped
(AppScope + OrgScope). An authorized run without a journal returns
journal: null and an empty data array with HTTP 200.
Arguments:
- automation_run: Automation run ID (
atr_...) whose journal to retrieve. - limit: Maximum number of entries to return. Defaults to 50; maximum is 100.
- after_cursor: Opaque cursor from the previous response's
after_cursorfield.
Returns:
Forward-paginated automation run journal entries.
160 def stream(self, automation_run: str) -> Iterator[AutomationRunStreamEvent]: 161 """ 162 Stream automation run status 163 Opens a Server-Sent Events connection that emits a `run_update` event whenever 164 the invoked automation run's status changes, replaying the current status on 165 connect and closing on a terminal status (`completed`, `failed`, `cancelled`) 166 or after the max stream duration. 167 168 Args: 169 automation_run: ID of the invoked automation run. 170 171 Returns: 172 Server-Sent Events stream 173 """ 174 yield from self._http.stream_sse_sync(f"/api/v1/automation_runs/{automation_run}/stream")
Stream automation run status
Opens a Server-Sent Events connection that emits a run_update event whenever
the invoked automation run's status changes, replaying the current status on
connect and closing on a terminal status (completed, failed, cancelled)
or after the max stream duration.
Arguments:
- automation_run: ID of the invoked automation run.
Returns:
Server-Sent Events stream