What This Example Shows
- A real production use case: a content moderation graph where edges carry severity and priority tags
- The shape of edge
metadatain the Graph Workflow request payload - How to encode severity (
low/medium/high/critical), routing target, and audit labels at the edge level - How the metadata flows through the response so downstream systems can read it
- Concrete ops patterns — log filters, SLO grouping, audit queries — that the metadata enables
Why This Matters
Content moderation is a routing problem masquerading as a classification problem. A post comes in, a classifier labels it, and the label has to get to the right place —critical to on-call humans inside an SLA, medium to a review queue, low to passive logging — each with different retry policies, audit requirements, and downstream tooling. When this routing logic lives inside agent prompts, it’s invisible to ops; when it lives in glue code, it’s not auditable. Edge metadata moves the routing semantics to where they belong: the edges of the DAG. Once ops can read severity: "critical" straight off the edge, dashboards group correctly, audit queries become one-liners, and the agents stay focused on the classification job. This tutorial shows the pattern in a content moderation DAG and then shows how downstream systems consume the metadata that comes back in the response.
Step 1: Setup
Step 2: Sketch the Moderation DAG
A single classifier fans out to three downstream routes, each handling a different severity tier. Each edge carries the routing semantics ops cares about.Step 3: Define the Agents
Step 4: Attach Severity and Routing Metadata to Edges
This is the load-bearing step. Each edge from the classifier into a downstream route gets ametadata block that encodes severity, priority, target queue, SLA budget, and audit label. The keys you pick become the keys your dashboards and audit scripts filter on, so standardize them across your team.
Three edges from the same source, each with different metadata, is the canonical pattern for moderation routing. The classifier doesn’t need to know about severity routing — every downstream node receives its label and the platform knows which edge it crossed and what tags that edge carried.
| Field | Type | What it’s for |
|---|---|---|
severity | "critical" | "high" | "medium" | "low" | The primary classification label, mirrored to the edge for filtering |
priority | "p0" | "p1" | "p2" | ... | SLO grouping in dashboards |
route | string | Logical destination — on_call_human, review_queue, analytics_sink |
sla_minutes / sla_hours | integer | Per-edge SLA budget surfaced in alerting |
retry_on_failure | boolean | Operational signal that this edge crosses an external boundary |
audit_tag | string | Regulatory/compliance label — "trust_and_safety", "pii", "sox" |
cost_center | string | Billing attribution for chargeback across teams |
Step 5: Submit the Workflow
Step 6: How the Metadata Flows Through the Response
Edge metadata is preserved with the compiled graph, surfaced in the workflow’s audit log, and made available to downstream systems in two places: the per-agent outputs (so a downstream consumer can correlate a result back to the edge that fed it) and the usage telemetry (so cost can be attributed to the edge’scost_center).
A downstream system reading the response typically does this:
The edge metadata you submitted is the same metadata your downstream code keys on. The platform doesn’t transform it — what you put in is what you get back to correlate against. Treat the metadata block as a forward contract between the graph and your moderation infrastructure.
Step 7: Critical-Severity Escalation — Read the Tagged Output
For the on-call path specifically, you want to fast-path the metadata-tagged record into your pager:How Ops Teams Actually Use This
Three concrete patterns once metadata is on every edge: Pattern 1 — Audit grep. Compliance asks “show me every moderation decision taggedtrust_and_safety in the last 7 days.” With audit_tag on the edges that cross the regulated boundary, this becomes a one-line log query rather than a substring search across prompts.
Pattern 2 — SLO grouping. Dashboards group p95 latency by priority (p0, p2, p4). You instantly see which on-call paths are missing their 15-minute SLA and which p4 paths can absorb slowdowns without paging anyone.
Pattern 3 — Retry budget enforcement. Edges tagged retry_on_failure: true are the ones that should be retried. When the retry budget for the day is consumed, you can selectively disable retries on priority: "p4" edges while keeping them on p0 ones — a one-line config change rather than a code deploy.
When Downstream Agents Should Inspect Upstream Metadata
The standard case is the one above: metadata is for ops and downstream systems, not the agent. There is one situation where the agent itself should read it: when a single downstream node receives edges from heterogeneous upstreams and needs to branch on which one fired. For that case, include the metadata in the prompt template you assemble before submission:Putting It All Together
Next Steps
- Graph Workflow Edge Formats Reference — all four supported edge syntaxes side by side
- Graph Workflows for Production Pipelines — fan-out/fan-in SDR enrichment DAG with retries and conditional paths
- Graph Workflow Example — additional DAG shapes including localization and code review