Facet
All docs

Artifact Type Mapping

Classifying your own outcome Artifacts as Decisions, Approvals, Policy Evaluations, Risk Assessments, and more, so Governance dashboards recognize them.

Artifact Type Mapping

Read this if: your application's Governance dashboard shows "No DECISION artifact observed yet for this Trace" (or the equivalent message for Approvals, Policy Evaluations, or Risk Assessments) even though your workflow clearly produces an outcome that is a decision, an approval, a policy check, or a risk assessment.

This section is for your own dev team — the people who wrote the LangGraph/Semantic Kernel/etc. workflow and know what its state keys actually mean. The platform and SDK deliberately do not know this; see "Why this exists" below.

Why this exists

The SDK's default strategy for turning a LangGraph node's state delta into Artifacts only ever learns an Artifact's name — the graph- state key it observed, e.g. "remediation", "final_answer", "answer". It never learns what that key means to your application; guessing that would bake business semantics into an adapter, which this platform's architecture deliberately forbids.

Classification matters because Governance's Decision Record, Policy Compliance, and Risk views only populate when an Artifact is actually typed DECISION / APPROVAL / POLICY_EVALUATION / RISK_ASSESSMENT — otherwise it falls back to the generic DOCUMENT type and those views correctly report nothing to show.

The SDK ships a generic, ontology-level default: an Artifact whose name contains a keyword like "decision", "recommend", "approv", "polic", or "risk" is classified accordingly, with no configuration required. This is not a guess about your business semantics — it's the same generic-vocabulary convention the ontology itself already uses to name these Artifact kinds. But it only works if your own state keys happen to contain one of those words. Most real workflows won't — e.g. "remediation", "final_answer", "escalation", "resolution" match nothing.

artifact_type_mapper is how you close that gap, explicitly and optionally, without ever requiring the platform or SDK to guess your own naming conventions.

Do you need one?

You need an artifact_type_mapper only if:

  1. Governance's Decision Record / Policy Compliance / Risk Assessment views show "No <TYPE> artifact observed yet", and
  2. You know (because you wrote the workflow) which of your own Artifact names is the equivalent outcome — a decision, an approval, a policy evaluation, or a risk assessment.

If the default keyword heuristic already classifies your Artifacts correctly, you don't need this at all.

Three equivalent ways to supply one

Which adapters support this today: instrument_graph() (LangGraph) and instrument_client() (Direct LLM API) both accept artifact_type_mapper=. instrument_kernel() (Semantic Kernel) does not support this yet — ask your Facet platform contact for the current status on that adapter. The examples below use instrument_graph(); for instrument_client() the argument name, shapes, and precedence rules (an Artifact's own already-set artifact_type always wins; the mapper is only a fallback) are identical.

instrument_graph() accepts an optional artifact_type_mapper= keyword argument in any of three shapes:

  1. A file-based mapping (recommended for real applications) — load a flat {artifact_name: artifact_type} table from a config file via adg.artifact_types.load_artifact_type_mapping(path). This keeps the naming knowledge in versioned, reviewable configuration rather than inline in workflow code — exactly the same philosophy as the Field Mapping guide, just scoped to one instrument_graph() call (one application) per file.
  2. A plain dict[str, str] inline, e.g. {"remediation": "DECISION"} — handy for a quick demo or a one-off script; load_artifact_type_mapping simply returns this same shape.
  3. A callable (name, payload) -> str | None, for classification logic beyond a flat name lookup (e.g. inspecting the payload itself — though most applications won't need this; payload is accepted purely for forward-compatibility).

Whichever shape you pass, resolution never overrides an Artifact's own already-set artifact_type (e.g. one a customer-authored ArtifactExtractor set explicitly because it genuinely knows its own domain) — a mapper is only ever consulted as a fallback for an Artifact whose artifact_type is still unset after extraction.

File format (TOML primary, JSON/YAML secondary)

Create an artifact_types.toml file next to your workflow module — TOML is the primary, recommended format, read via the standard library's tomllib (no extra dependency). It is a flat table whose keys are the Artifact names your own workflow produces, and whose values are the canonical type to classify them as:

# artifact_types.toml
remediation = "DECISION"
escalation = "APPROVAL"

.json is also read with the standard library only, with an identical flat-object shape:

{"remediation": "DECISION", "escalation": "APPROVAL"}

YAML is a secondary, optional format — it requires pyyaml to be installed separately (not a core or optional-extra dependency of adg), for teams who already standardize on YAML elsewhere:

remediation: DECISION
escalation: APPROVAL

The canonical artifact types a Governance-relevant projection recognizes today are DECISION, APPROVAL, POLICY_EVALUATION, RISK_ASSESSMENT, OBLIGATION, and EXCEPTION — these are the same canonical Artifact types Field Mapping's canonical fields are keyed by, since classification and field mapping are two halves of the same pipeline: classify first, then map that Artifact's own field names.

Every value must be a string — a non-string value, or a file whose top level isn't a flat object/table, raises ValueError immediately when loaded, to surface a malformed file rather than silently misclassifying.

Wiring it into your workflow

from pathlib import Path

from adg import instrument_graph
from adg.artifact_types import load_artifact_type_mapping

_ARTIFACT_TYPES = load_artifact_type_mapping(
    Path(__file__).parent / "artifact_types.toml"
)

observed_graph = instrument_graph(
    compiled_graph,
    artifact_type_mapper=_ARTIFACT_TYPES,
)

This is never called automatically by the SDK — same convention as adg.config.from_file: you write exactly one explicit line yourself. Every other instrument_graph() call in the codebase continues to work unchanged; this argument is entirely optional and additive.

We've validated this pattern against several of our own real workflows, each shipping its own artifact_types.toml tagging its own outcome Artifact.

Opting out entirely

If you'd rather have every Artifact fall through to the transport's own generic default (DOCUMENT) than have the platform's keyword heuristic applied at all, pass the explicit opt-out:

from adg.artifact_types import no_artifact_type_mapper

observed_graph = instrument_graph(
    compiled_graph,
    artifact_type_mapper=no_artifact_type_mapper,
)

This mirrors the SDK's equivalent opt-out mechanism for Context extraction — the mechanism is always on and part of the SDK; only the concrete classification strategy is optional.

Relationship to Field Mapping

Classification (artifact_type_mapper) and Field Mapping (the Artifact Payload Field Mapping aspect specifically) solve two different, sequential problems:

Artifact Type Mapping Artifact Payload Field Mapping
Question it answers Which kind of Artifact is this? What do this Artifact's own payload fields mean?
Runs At observation time, in the SDK/adapter At projection time, in the platform's engine
Input An Artifact's name An already-typed Artifact's payload field names
Output artifact_type (DECISION, ...) Canonical field values (outcome, confidence, ...)
Config lives in artifact_types.toml, next to your workflow Your SDK-side config file, or the Customer Portal's "Vocabulary Mapping" tab

A Decision Record needs both to show full detail: first an Artifact must be classified DECISION (this guide), then its own payload field names need mapping onto outcome/confidence/decision_type/ explanation if they don't already literally match — see the Field Mapping guide. Classification with no field mapping configured still renders a Decision Record — just via the raw-payload fallback view, not the fully field-mapped one.

Where to go next

  • The Field Mapping guide — mapping an already-typed Artifact's own payload field names onto canonical fields a projection expects.
  • The Semantic Mapping guide — declaring business-meaning classifications over already-observed data.
  • The Ontology Mapping Decision Guide — for the earlier question of which of your own objects/calls should become a Trace, Activity, Artifact, or Resource in the first place.