← All examples
04

Canonical Grid model

External Enrichment

Portable model that delegates async work to external workers.

Scale
Medium
Source
04-external-enrichment.grid
Length
29 lines
Collection
Live data & operations
Level
Intermediate
Runtime
External functions
Version
1.0.0

Watch it in Grid

See this model in motion.

Watch the model respond in the product, then inspect the exact source and checkpoints on this page.

Companion film

Live data in

Bring in a live FX rate, contain a failed ML signal with a deterministic fallback, and keep exposure recalculating.

19 secGrid 0.61.0
Open film page

What this model gives you

A fallback-safe enrichment flow whose raw FX and scoring work stays visible while decisions remain computable.

25 min to study · Source reviewed 2026-08-24

Continue with guided practice

What to notice

  • Eager and lazy work
  • Named external arguments
  • Raw result inspection
  • Explicit fallback policy

Requirements

  • Async worker runtime
  • Network for live FX
  • Configured scoring route for live ML_SCORE

Expected checkpoint

A known state for this walkthrough.

Before providers return, or after a terminal failure without a satisfactory cached value, using the canonical fallback constants.

Converted amount
262,500C1 fallback path
Score
0C2 fallback path
Decision
auto-approveC3 canonical policy
Cross-rate
1.1905C4 fallback path
01 · Request

Raw provider work stays inspectable

FX_RATE starts eagerly while ML_SCORE remains lazy until a dependent asks for it.

02 · Protect

Fallback policy belongs downstream

DEFAULT keeps calculations available without replacing the raw binding or hiding its external status.

03 · Isolate

Only changed arguments invalidate work

A new amount recomputes conversion locally; a changed feature vector invalidates only the scoring branch.

04-external-enrichment.grid
Get Grid
MODEL "External Enrichment"
DESCRIPTION "Portable model that delegates async work to external workers."
VERSION "1.0.0"
AUTHOR "Grid Team"
TAGS "canonical", "portable", "external", "async"

# Inputs
A1 IS currency = 250000
A2 IS percentage = 18pct
A3 = 0.12
A4 = 0.18
A5 = 0.27
A6 = 0.43
A7 = "EUR"
A8 = "USD"

# External signals
B1 = FX_RATE(A7 AS base, A8 AS quote)
B2 ~= ML_SCORE(A3:A6)
B3 = FX_RATE("GBP", "USD")

# Fallback-safe analytics
C1 IS currency = ROUND(A1 * (B1 DEFAULT 1.05), 2)
C2 = B2 DEFAULT 0
C3 = C2 > 0.35 THEN "manual-review" ELSE "auto-approve"
C4 = ROUND((B3 DEFAULT 1.25) / (B1 DEFAULT 1.05), 4)
C5 = `eur_usd={B1 DEFAULT 1.05} score={C2}`

END MODEL