Skip to content

add get_artifacts tool for viewing flow/task run outputs #99

@zzstoatzz

Description

@zzstoatzz

overview

add read-only tool to query artifacts created by flow/task runs

what are artifacts?

artifacts are data outputs from runs:

  • types: markdown, table, link, progress, image
  • use cases: model metrics, reports, visualizations, progress tracking, external links
  • key features: versioned by key, attached to runs, support filtering

proposed tool

@mcp.tool
async def get_artifacts(
    key: str | None = None,
    artifact_type: Literal["markdown", "table", "link", "progress", "image"] | None = None,
    flow_run_id: str | None = None,
    task_run_id: str | None = None,
    limit: int = 50,
) -> ArtifactsResult:
    """get artifacts created by flow/task runs.
    
    artifacts are outputs from runs like model metrics, reports,
    tables, progress indicators, or links to external resources.
    
    examples:
        - get all artifacts: get_artifacts()
        - get artifacts by key: get_artifacts(key="model-metrics")
        - get artifacts from specific run: get_artifacts(flow_run_id="...")
        - get only tables: get_artifacts(artifact_type="table")
    """

implementation notes

types to add (types.py):

class ArtifactDetail(TypedDict):
    id: str
    key: str | None
    type: str  # "markdown", "table", "link", "progress", "image"
    description: str | None
    data: Any  # the actual artifact data
    flow_run_id: str | None
    task_run_id: str | None
    created: str | None
    updated: str | None

class ArtifactsResult(TypedDict):
    success: bool
    count: int
    artifacts: list[ArtifactDetail]
    error: str | None

client code (_prefect_client/artifacts.py):

  • use client.read_artifacts() with appropriate filters
  • support filtering by ArtifactFilter (key, type), FlowRunFilter, TaskRunFilter

value

enhances observability into run outputs - useful for viewing metrics, reports, and tracking produced by flows

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions