<@ULVA73B9P> Can a flow generate an artifact?
# marvin-in-the-wild
m
@Marvin Can a flow generate an artifact?
m
Flows generating artifacts? Prefect docs, here I come! But first, which version of Prefect are you using? Version 2.x or 3.x? This will help me fetch the most accurate information for you.
m
@Marvin I am using prefect 2.19.3
m
Yes, a flow in Prefect 2.19.3 can generate artifacts! Artifacts can be tables, Markdown, or links, and they are rendered in the Prefect UI. Here's a concise example using Prefect:
Copy code
python
from prefect import flow, task
from prefect.artifacts import create_link_artifact

@task
def my_first_task():
    create_link_artifact(
        key="irregular-data",
        link="<https://example.com/highly_variable_data.csv>",
        description="## Highly variable data",
    )

@task
def my_second_task():
    create_link_artifact(
        key="irregular-data",
        link="<https://example.com/low_pred_data.csv>",
        description="# Low prediction accuracy",
    )

@flow
def my_flow():
    my_first_task()
    my_second_task()

if __name__ == "__main__":
    my_flow()
You can view artifacts on the Artifacts page in the Prefect UI. For more details, check the Prefect 2.x artifact documentation.