Skip to main content
Challenge

Mortgage Bond Prepayment Risk Forecasting Stream with AI SDK & Mastra AI

AI-driven refinancing platforms accelerate mortgage prepayments, destabilizing traditional MBS yield models. Build an interactive AI SDK dynamic agent stream backed by Mastra AI workflow nodes to forecast prepayment velocity and portfolio interest rate sensitivity within sub-200ms latency limits.

Business OperationsHosted by Vera
Challenge brief

What you are building

The core problem, expected build, and operating context for this challenge.

Implement a streaming financial risk analysis engine using Vercel AI SDK data streaming and Mastra AI workflow components.

Delivery guide

How work is evaluated

Evaluation

Evaluates accuracy of dynamic CPR prepayment velocity and yield calculations in real-time response streams.

Datasets

Challenge datasets

Public datasets, plus the private datasets you have access to.

Evaluation rubric

How submissions are scored

These dimensions define what the evaluator checks and which criteria separate a passable run from a strong one.

Dimensions
2 scoring checks
Binary
2 pass or fail dimensions
Ordinal
0 scaled dimensions
Dimension 1

cpr_range_test

Ensures CPR calculation stays within expected quantitative limits

Binary check

This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.

Dimension 2

cpr_mean_absolute_error

MAE against theoretical prepayment benchmark model • target: 0.5 • range: 0-5

Binary check

This dimension contributes its full weight only when the submission satisfies the requirement. Partial credit is not awarded.

Learning goals

What you should walk away with

  • Stream dynamic MBS portfolio risk recalculations using Vercel AI SDK AI Stream response handlers.

  • Execute prepayment vector evaluations through embedded Mastra AI data nodes.

  • Calculate Conditional Prepayment Rates (CPR) under changing interest rate shocks.

  • Maintain real-time streaming latency under 200 milliseconds.

Resources and assets

Reference links and supporting material

Dataset notes

Historical and synthetic MBS pool data, current interest rate curves, and simulated AI refinancing adoptability ratios.

Challenge setup

Evaluates accuracy of dynamic CPR prepayment velocity and yield calculations in real-time response streams.

Challenge input

JSON containing pool_wac, current_rate, ai_refi_penetration

AI SDK

Framework assignment for streaming multi-provider dynamic agent UI integration.

Mastra AI

Additional tool for complex workflow step coordination.

Evaluated output

JSON with projected_cpr, price_duration_impact

Evaluation checks
  • Ensures CPR calculation stays within expected quantitative limits
  • MAE against theoretical prepayment benchmark model • target: 0.5 • range: 0-5
Configured evaluation evidence
  • Benchmark: FinRisk-Stream-Bench
  • Cpr Mean Absolute Error target: 0.5
  • 1 public reference case
Configured runtime
  • JavaScript execution harness
  • javascript sandbox (unavailable on Versalist)

Summary shows the first task, up to three tools, and up to three evidence items. Open the technical recipe to view all configured items.

View technical recipe

Configured tools

Action Space
  • Mastra AI · Required
  • Hamming · Optional
Observation
  • Arize Phoenix · Optional
Reward / Eval
  • Arize Phoenix · Optional
Orchestration
  • Mastra AI · Required

Evaluation contract

  • cpr_range_test · Weight 1
  • cpr_mean_absolute_error · Weight 1

Metrics

  • cpr_mean_absolute_error · Target 0.5

Benchmarks

  • FinRisk-Stream-Bench
  • general

Reference cases

  • 1 public reference case

Workflow tasks

  1. Task 1

    Input: JSON containing pool_wac, current_rate, ai_refi_penetration

    Output: JSON with projected_cpr, price_duration_impact

    Execution harness: JavaScript

Evaluation tools

  • AI SDK · Streaming Agent Framework
  • Mastra AI · Agent Systems Framework

Recipe freeze marker

No recipe freeze time is recorded.

Frequently Asked Questions about Mortgage Bond Prepayment Risk Forecasting Stream with AI SDK & Mastra AI