Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions content/docs/integrations/api-triggers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,21 @@ metadata records the automation version (`flow_version_id`,
In the app, the same runs appear on the automation's **Runs** tab with the
version, trigger, input, branch, and links to the transcript and sandbox.

## Read the output

If the automation's instructions have the agent commit a JSON file under
`.mogplex/artifacts/`, read it once the run succeeds:

```txt
GET /api/v1/mogplex/automations/{automationId}/runs/{jobRunId}/artifact?path=.mogplex/artifacts/<name>.json
```

The file is read from the run's working branch with your account's GitHub
access, so the integration never holds a GitHub credential. A key limited to
automations can call it. See
[Read an automation run artifact](/reference/api#read-an-automation-run-artifact)
for the response and errors.

## Limit the key to automations

A key that only needs to trigger automations should not be able to do anything
Expand Down
1 change: 1 addition & 0 deletions content/docs/mcp/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ manual variables do not inherit these changes.
| `mogplex_cancel_automation_run` | `write` | Cancel a Flow job using its automation ID and job run ID. |
| `mogplex_list_automation_runs` | `read` | List recent executions and node or dispatch summaries. |
| `mogplex_get_automation_run_logs` | `read` | Read node runs, dispatch events, AI calls, errors, usage, and review findings. |
| `mogplex_get_automation_run_artifact` | `read` | Read a JSON file an API-triggered run committed under `.mogplex/artifacts/`. |
| `mogplex_rerun_pr_review` | `write` | Queue another Mogplex PR Review run for a pull request. |

Automation listing defaults to 50 records and accepts a maximum `limit` of
Expand Down
46 changes: 46 additions & 0 deletions content/docs/reference/api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ type MogplexApiError = {
| `POST` | [`/automations/{automationId}/trigger`](#trigger-an-automation) | `write` | Trigger the published automation. |
| `GET` | [`/automations/{automationId}/runs`](#list-automation-runs) | `read` | List recent automation runs. |
| `GET` | [`/automations/{automationId}/runs/{runId}`](#read-automation-run-logs) | `read` | Read detailed automation run logs. |
| `GET` | [`/automations/{automationId}/runs/{runId}/artifact`](#read-an-automation-run-artifact) | `read` | Read a JSON file an API-triggered run committed. |
| `POST` | [`/pr-reviews/rerun`](#rerun-a-pr-review) | `write` | Queue a fresh Mogplex PR review. |
| `POST` | [`/runs`](#start-a-run) | `write` | Start a Codex, Claude Code, or Mogplex agent run. |
| `GET` | [`/runs/{runId}`](#get-a-run) | `read` | Read run state. |
Expand Down Expand Up @@ -668,6 +669,51 @@ No query or body. Response payload: `{ run: AutomationRunDetail | null }`.
The detail includes node runs, dispatch events, AI calls and events, errors,
usage, and review findings.

### Read an automation run artifact

`GET /automations/{automationId}/runs/{runId}/artifact`

Reads a JSON file that an [API-triggered](/integrations/api-triggers) run
committed under `.mogplex/artifacts/` on its own working branch. The run must
have succeeded. The repository and branch come from the run's trigger record,
and the file is read with your account's GitHub access. Automation runs don't
record a final commit, so the file is read at the branch tip; `commitSha` names
the commit that was read.

Request query:

```typescript
type AutomationRunArtifactQuery = {
path: string; // A .json file under .mogplex/artifacts/, at most 1 MiB.
};
```

Response payload:

```typescript
type AutomationRunArtifactData = {
artifact: {
automationId: string;
jobRunId: string;
repoId: string;
path: string;
branch: string; // mogplex/automation-<16 hex characters>
commitSha: string;
pinned: false;
content: unknown; // The parsed JSON file.
};
};
```

Endpoint-specific errors:

| Code | HTTP | Meaning |
| --- | --- | --- |
| `BAD_REQUEST` | 400 | The ids aren't UUIDs, the path isn't a JSON file in `.mogplex/artifacts/`, or the file is over 1 MiB or isn't valid JSON. |
| `NOT_FOUND` | 404 | The automation, run, repository, branch, or file doesn't exist for this account. |
| `CONFLICT` | 409 | The run hasn't succeeded, wasn't triggered through the API, or GitHub needs reconnecting. |
| `SERVICE_UNAVAILABLE` | 502 | GitHub couldn't be reached or returned an error. Retry. |

## PR reviews

### Rerun a PR review
Expand Down
Loading