docs/v3/how-to-guides/ai/flow-run-log-summaries.mdx
<Note>AI log summaries are only available in Prefect Cloud.</Note>
An AI log summary is a short, AI-generated description of a flow run's logs, such as
Failed due to a KeyError in the extract_data task. Instead of scrolling through raw logs to
work out what happened, you get the gist in one line.
Summaries are generated on demand and cached, so requesting the same flow run's summary again returns the cached result rather than calling the model a second time.
AI log summaries depend on AI features being enabled for your account. An account administrator enables them under Settings > Account Settings > Controls by turning on the Marvin AI toggle in the Data processing section. This setting is account-wide and applies to all workspaces.
While AI features are disabled, no summaries are produced and the model is never called.
<Note> AI-enabled features may use third-party models. See the **Marvin AI** setting for links to Prefect's data processing addendum and subprocessor documentation. </Note>Open a flow run in the Prefect Cloud UI and select the Logs tab. Click the AI summary icon in the top-right corner of the log panel, next to the log search, to generate a summary of the run's logs. The summary appears inline above the logs. This is useful for investigating a single run after the fact.
You can also surface the summary automatically in notifications sent by an automation, so an on-call recipient sees the likely explanation inline without opening the UI.
Reference the flow_run_log_summary variable in a custom notification
template on an automation triggered by a flow
run event:
Flow run {{ flow_run.name }} entered state {{ flow_run.state.name }}.
{%- if flow_run_log_summary %}
AI summary: {{ flow_run_log_summary }}
{%- endif %}
A few details to keep in mind:
{{ flow_run_log_summary }}. The default
notification body does not include it.Wrapping the variable in an {%- if flow_run_log_summary %} block keeps the notification tidy
when the summary is empty, so recipients do not see a dangling AI summary: label.