<@ULVA73B9P> I'm using `create_markdown_artifact(k...
# ask-marvin
a
@Marvin I'm using
create_markdown_artifact(key="dbt-build-tests", markdown=tests_markdown)
, but I don't see the artifact in the UI. What am I missing?
m
thought for 126.8 seconds
The big thing: artifacts only show up in the UI if they’re being created against a Prefect API/backend that the UI is connected to. A few common gotchas for your exact case: 1.
key
only affects where it appears, not whether it gets persisted
You’re already passing
key="dbt-build-tests"
, which is correct if you want it on the main Artifacts page. 2. It must run in a Prefect flow/task context Make sure this is being called inside a
@flow
or
@task
, not just in a plain Python script. Example:
Copy code
python
from prefect import flow
from prefect.artifacts import create_markdown_artifact

@flow
def my_flow():
    create_markdown_artifact(
        key="dbt-build-tests",
        markdown="# dbt test results\n\nAll good"
    )

if __name__ == "__main__":
    my_flow()
3. You need to be connected to Prefect Cloud or a persistent Prefect server If you’re just running locally without a configured API, the artifact may not end up somewhere you can browse in the UI you’re looking at. Check:
Copy code
bash
prefect config view
Look for
PREFECT_API_URL
. If you’re using Cloud, it should point to Cloud. If you’re using self-hosted server, it should point to that server. 4. Check the right UI location With a
key
, the artifact should appear on the Artifacts page, and also be associated with the run. Without a
key
, it only appears on the run’s Artifacts tab. 5. Reusing the same key updates/version-tracks that artifact If you keep writing to
dbt-build-tests
, you may not see multiple separate artifacts — you may be updating the same keyed artifact lineage. 6. The flow run must actually execute successfully far enough to create it If the run fails before
create_markdown_artifact(...)
is reached, nothing will appear. If you want, I can help you debug this quickly. The most useful next info would be: - are you using Prefect Cloud or self-hosted server? - are you calling this inside a flow/task? - do you see the flow run in the UI, just not the artifact? Docs: - Artifacts concept docs - Artifacts how-to - `prefect.artifacts` API reference
n
hi @Adrien Besnard - marvin's answer seems not so useful. did you figure out what you needed?
a
Hello @Nate! Yes, the issue was on my side, actually. An exception was thrown before the artifact creation facepalm
n
that'll do it! glad you got it cleared up 👍