Real-time risk scoring with JetGraph
Score every event against committed graph history, ingest the outcome, and let AI agents inspect why an entity or neighborhood spiked. JetGraph supplies live graph features; your application owns the model.
The scoring loop
Event → Query historical graph (GetEdgeState, QueryNodeHistogram, GetFraudContext, GetNeighborCount) → Score (your rules, ML model, or registered scoring_profile) → Ingest event (IngestTransaction / UpsertEdge — always, including declines) → Manage cases (CreateFraudCase / ResolveFraudCase)
Querying before ingest avoids reading your own uncommitted write and keeps novelty checks honest. Recording declines is essential: otherwise velocity counters and histograms under-count blocked attempts.
Features the engine supplies on this loop
| Signal | Current API | Role in a score |
|---|---|---|
| Pair novelty & activity | GetEdgeState | found: false for first-time counterparties; tx_count, approx_sum, and up to 4 sliding activity windows |
| Rolling bursts & value bins | QueryNodeHistogram | Hourly and daily 8-bucket distributions across all counterparties |
| Case exposure | GetFraudContext | Open and confirmed cases linked to the entity or transaction counterparties |
| Neighborhood & rings | GetNeighbors / Cypher MATCH | Shared devices, IPs, merchants, or transition paths |
| Fan-out cardinality | GetNeighborCount | Distinct neighbor count (with HyperLogLog estimate when enabled) |
| 32-slot node vectors | GetStoredNodeFeatureVector | Pre-configured node feature slots with fallback and confidence |
Relative to a tabular feature store
A feature store serves precomputed columns keyed by entity ID. JetGraph keeps a live graph so features that are relationships — first-time pairs, shared identifiers, weighted lookalikes, and case links — stay relationships. Many stacks run both side by side: feature store for tabular history, JetGraph for live relationship signals. See vs feature stores.
Technical sketch (jetgraph-client Rust)
// Phase 1 — historical graph state
let state = client.get_edge_state(
"TRANSACTS_AT", card.clone(), merchant.clone(), None, Some(&[300, 3600])
).await?;
let hist = client.features()
.query_node_histogram(card.clone(), "TRANSACTS_AT", 1, 0).await?;
let ctx = client.features()
.get_fraud_context(&[card.clone(), device.clone()]).await?;
// Phase 2 — your score
let is_new = state.as_ref().map_or(true, |s| !s.found);
let mut risk = 0.0_f32;
if is_new { risk += 0.15; }
if hist.total_events > 30 { risk += 0.25; }
if !ctx.flagged_nodes.is_empty() { risk += 0.45; }
// Phase 3 — always ingest; open a case when thresholds breach
client.upsert_edge("TRANSACTS_AT", card.clone(), merchant, Some(amount), None, None).await?;
if risk > 0.7 {
client.features().create_fraud_case(
&case_id, &[card, device], risk, "auto_decline", Some("high_velocity_new_merchant")
).await?;
}
Explain and monitor with an agent
When a risk rule or score spikes, an analyst or AI agent connected to /mcp can inspect the same live graph without touching production scoring code — calling get_histogram, get_edge_state, get_feature_vector, and list_segments to explain why an entity crossed a threshold and refine segments live.