Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:PrefectHQ Prefect Create Markdown Artifact

From Leeroopedia


Metadata
Source Repo: Prefect
Domains Observability, Orchestration
Last Updated 2026-02-09 00:00 GMT

Overview

Concrete function for creating markdown-formatted artifacts in the Prefect UI provided by the Prefect library.

Description

The create_markdown_artifact function from prefect.artifacts creates a markdown-formatted artifact associated with the current flow or task run. The artifact is displayed in the Prefect UI and persists beyond the run.

Code Reference

  • Repository: https://github.com/PrefectHQ/prefect
  • File: src/prefect/artifacts.py (L478) for the function, examples/atproto_dashboard_with_prefect_assets.py (L135-149) for usage
  • Signature:
def create_markdown_artifact(
    markdown: str,
    key: Optional[str] = None,
    description: Optional[str] = None,
) -> UUID:
    """Create a markdown artifact visible in the Prefect UI.

    Args:
        markdown: Markdown-formatted content string.
        key: Optional unique key for the artifact (for deduplication).
        description: Optional human-readable description.
    Returns:
        UUID of the created artifact.
    """
  • Import: from prefect.artifacts import create_markdown_artifact

I/O Contract

  • Inputs: markdown (str, required), key (str, optional -- unique artifact key), description (str, optional)
  • Outputs: UUID -- identifier of the created artifact, visible in Prefect UI

Usage Example

from prefect.artifacts import create_markdown_artifact
from textwrap import dedent

def create_analytics(processed_data: dict) -> dict:
    analytics = {"total_items": len(processed_data["items"]),
                 "created_at": "2026-01-01T00:00:00Z"}

    create_markdown_artifact(
        key="analytics-summary",
        markdown=dedent(f"""
            # Analytics Summary
            - **Total Items**: {analytics["total_items"]}
            - **Created**: {analytics["created_at"]}
        """),
        description="Analytics summary for this pipeline run",
    )
    return analytics

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment