Back to Prompt Library
implementation
Define Mastra AI Payment Routing Workflow
Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.
Linked challenge: Low-Latency Payment Routing and Fraud Risk Engine with Mastra AI
Format
Code-aware
Lines
14
Sections
3
Linked challenge
Low-Latency Payment Routing and Fraud Risk Engine with Mastra AI
Prompt source
Original prompt text with formatting preserved for inspection.
14 lines
3 sections
No variables
0 checklist items
import { Workflow, Step } from '@mastra/core';
import { z } from 'zod';
const routeStep = new Step({
id: 'evaluate-rails',
inputSchema: z.object({ amount: z.number(), currency: z.string() }),
outputSchema: z.object({ optimalRail: z.string(), fee: z.number() }),
execute: async ({ context }) => {
// Call BentoML risk service and evaluate optimal rail
return { optimalRail: 'STRIPE_EU', fee: 0.85 };
}
});
export const paymentWorkflow = new Workflow('payment-router')
.step(routeStep)
.commit();
Adaptation plan
Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.
Keep stable
Hold the task contract and output shape stable so generated implementations remain comparable.
Tune next
Update libraries, interfaces, and environment assumptions to match the stack you actually run.
Verify after
Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.