Prefect Cloud ExecModule
Overview
PrefectCloudModule reads flows and flow runs from one Prefect Cloud workspace. Use it to find the flow that owns an upstream job, inspect runs in a specific state, or check the exact run tied to a handoff. A ValkyrAI workflow can use the returned state and timestamps to decide when to continue, wait, or send an alert.
Usage
- Obtain a Prefect Cloud API key for a user or service account with access to the workspace and permission to view flows and flow runs.
- Save a Prefect Cloud connection in the Integration Account Console.
- Add a Prefect Cloud step in Workflow Studio and select the saved connection under General > Connection.
- Choose List Flows to find a flow ID, List Flow Runs to inspect its runs, or Get Flow Run when an upstream step provides a run ID.
Inputs
| Input | Type | Purpose |
|---|---|---|
operation | string | list_flows (default), list_flow_runs, or get_flow_run. |
limit | integer | List page size from 1 to 100. Defaults to 50. |
offset | integer | List offset from 0 to 1,000,000. Defaults to 0. |
flowId | UUID string | Optional flow filter for list_flow_runs. |
stateType | string | Optional Prefect state type filter for list_flow_runs, such as FAILED or RUNNING. |
flowRunId | UUID string | Required run identifier for get_flow_run. |
Outputs
| Output | Type | Meaning |
|---|---|---|
status | string | success or error for the lookup. |
httpStatus | integer | Provider HTTP status when available. |
flows | array | Flow summaries on the current list_flows page. |
flowRuns | array | Run summaries on the current list_flow_runs page. |
count | integer | Number of items on the current list page. |
nextOffset | integer | Next list offset when the page is full and the next offset is within bounds. |
flowRun | object | The run summary returned by get_flow_run. |
error | object | Sanitized code, message, and retryable, with retryAfterSeconds when available. |
A flow summary contains the flow id and available name. A run summary contains the run id and flowId and available name, stateType, stateName, expectedStartTime, startTime, and endTime. Timestamps are expressed in UTC when present. Use stateType to branch on the run's outcome. stateName provides more detail for operators, such as a late run within the SCHEDULED type.
IntegrationAccount Requirements
Use an authorized READY IntegrationAccount with provider PREFECT_CLOUD. Enter the key in Prefect Cloud API Key (protected apiKey), the account UUID in Prefect Account ID (accountId), and the workspace UUID in Prefect Workspace ID (username). The workflow credential broker resolves the account fields at execution time.
Grant the key's user or service account workspace access with the see_flows permission. Scope access to the workspace the workflow monitors. Use a service account where your Prefect plan supports it and your team needs to rotate the key independently of a user. Prefect service accounts
Configuration
The connector uses HTTPS bearer authentication at the fixed api.prefect.cloud endpoint. The saved account and workspace IDs determine the request path. Put flow IDs, run IDs, and filters in workflow inputs and keep the API key in the saved connection.
Operations
- List Flows returns a page of visible flow IDs and names in ascending name order. Use the flow ID to narrow subsequent run queries.
- List Flow Runs returns a page of run summaries ordered by expected start time, newest first. Apply a flow ID and state type together when triaging a specific pipeline.
- Get Flow Run reads the current state and available timestamps for one run. Use an exact run ID for a handoff tied to a particular execution.
Errors and Failure Modes
| Condition | What to check |
|---|---|
| Invalid input | Check the operation, identifier format, state type, and pagination bounds. |
| Saved connection unavailable | Check that the selected connection is ready and has a key and both workspace identifiers. |
| HTTP 401 or 403 | Verify the key is current and its principal can view flows in the saved workspace. |
| HTTP 404 | Verify the account, workspace, and requested run ID. |
| HTTP 429 or transient provider error | Respect retry guidance when present and use bounded backoff. |
| Timeout or oversized response | Requests have a 20-second timeout and decoded responses are limited to 2 MiB. Reduce the page size or narrow the run filter before retrying. |
Example
A reporting workflow receives the Prefect run ID for the job that prepares its input. Before distributing the report, it checks the exact execution.
{
"operation": "get_flow_run",
"flowRunId": "6c74f6ca-075f-4c65-9fd2-f692485e8832"
}
An example successful lookup returns the run summary.
{
"status": "success",
"httpStatus": 200,
"flowRun": {
"id": "6c74f6ca-075f-4c65-9fd2-f692485e8832",
"flowId": "917765c5-41de-46a5-8659-67a0f006e52f",
"name": "prepare-orders-daily",
"stateType": "COMPLETED",
"stateName": "Completed",
"expectedStartTime": "2026-11-07T05:00:00Z",
"startTime": "2026-11-07T05:00:27Z",
"endTime": "2026-11-07T05:06:48Z"
}
}
Check the run state and completion time against your reporting window before continuing. A successful lookup can return a failed or still-running execution. Give the workflow a separate branch for those outcomes and for lookup errors.
Notes
- Pagination. Reuse
nextOffsetwith the same filters and page size. A full page can be followed by an empty page. New runs and state changes between requests can shift offset pages. - Rate limits. Space recurring checks and cap retries. Use the returned retry guidance when Prefect throttles a request.
- API limits. The connector returns selected flow and run metadata for Prefect Cloud. Flow parameters, logs, task runs, result payloads, and self-hosted Prefect Server are outside its scope.
- Idempotency and destructive behavior. The operations are read-only, including the provider's POST filter endpoints. Repeated reads can return a newer state. The connector does not start, retry, cancel, or modify runs.