<@ULVA73B9P>: Is it possible to find out who was r...
# ask-marvin
j
@Marvin: Is it possible to find out who was responsible for a state transition on a flow run? Was it manually done by a user, a normal one within Prefect’s lifecycle, from an automation, etc?
m
thought for 407.6 seconds
Short answer: partly. In Prefect 3.x there isn’t a “changed_by” field on a flow run state itself, but you can usually attribute the transition by looking at Events and (in Cloud) Audit Logs. What you can see today - Prefect Cloud (best fidelity) - Audit Logs show the actor for state changes triggered via UI/CLI/API (user or service account) and for automation-driven actions. Filter by resource “Flow Run” and actions like “Set state”, “Cancel run”, etc. - The flow run’s Events feed will show: - Normal lifecycle transitions (system/orchestrator-driven) - Automation actions (e.g., ChangeFlowRunState, CancelFlowRun) with the Automation listed as a related resource - Manual actions will typically correlate with an Audit Log entry that names the user/service account - Links: - Audit Logs: Prefect Cloud Audit Logs - Prefect OSS - You can read the state history for a run (names, timestamps, messages), but it does not include an actor. API: Read flow run states - If you’re running with the events system enabled, the Events feed can help infer provenance (e.g., automation actions will appear as events referencing the automation). However, OSS does not provide a full audit trail of user identity like Cloud. How to interpret transitions - Normal lifecycle: transitions such as Pending → Running → Completed/Failed are set by Prefect’s orchestration system. These will not have a “user” actor. - Automation-initiated: look for events like automation actions (ChangeFlowRunState/CancelFlowRun) that list the Automation as a related resource. - Manually initiated (UI/CLI/API): in Cloud, use Audit Logs to see which user or service account performed the change. In OSS, you’ll need to infer from your operational context and any events/logs you emit. Clarifying question - Are you using Prefect Cloud or OSS? If Cloud, I can point you to the exact UI/API filters to see the actor for the specific flow run. If OSS, I can show you how to pull state history and any available events to infer the source.