Building an AI Fairy Tale Generator with JavaScript, PowerShell, .NET, and Local Ollama (AdvantageBuilder Demo) A developer demonstrated AdvantageBuilder's ability to orchestrate multiple runtimes—JavaScript V8, PowerShell, .NET, and local AI via Ollama—to generate and narrate fairy tales entirely offline. The workflow uses a JavaScript macro to call a PowerShell helper that queries Ollama's local REST API with the llama3.1 model, then feeds the generated text to a .NET System.Speech helper for voice narration. Recently I published a demo showing how AdvantageBuilder can orchestrate multiple runtimes — JavaScript V8, PowerShell, .NET, and local AI Ollama — to generate and narrate fairy tales on demand. 🎬 Watch the full demo: https://youtu.be/ah8jf WwkLE https://youtu.be/ah8jf WwkLE This article breaks down how the workflow works and includes real code examples you can use inside AdvantageBuilder. ⭐ Why This Demo Is Interesting Most AI demos rely on cloud APIs. This one runs entirely locally: JavaScript V8 macro PowerShell helper Ollama model llama3.1:8b-instruct-q4 K M .NET System.Speech voice narration All orchestrated inside AdvantageBuilder It’s a clean example of multi‑runtime automation. The main macro is written in JavaScript V8. It calls two helpers: AI Ollama Helper → generates the fairy tale InvokeSpeech → narrates the fairy tale aloud Here’s a simplified version of the JS macro: JAVASCRIPTV8 // --- Step 1: Generate a fairy tale using the AI helper --- let aiParams = {}; aiParams.Model = "llama3.1:8b-instruct-q4 K M"; aiParams.Prompt = "Write a short fairy tale suitable for narration. Keep it under 200 words."; let fairyTale = callMacro false, 'AI Ollama Helper', 'Macro Main Helpers', aiParams ; // --- Step 2: Feed the fairy tale to the voice helper --- let voiceParams = {}; voiceParams.Voice = "Microsoft Zira Desktop"; // or David voiceParams.TextToSpeech = fairyTale; callMacro false, 'InvokeSpeech', 'Macro Main Helpers', voiceParams ; /JAVASCRIPTV8 AdvantageBuilder automatically handles: So JavaScript can call PowerShell seamlessly. This helper sends a prompt to Ollama’s local REST API and returns the generated text. php POWERSHELLSCRIPT $ args.Model $ args.Prompt $model = "llama3.1:8b-instruct-q4 K M" $prompt = "" if $ args -ne $null { $model = $ args.Model $prompt = $ args.Prompt } $body = @{ model = $model prompt = $prompt stream = $false } | ConvertTo-Json -Depth 5 $response = Invoke-RestMethod -Uri "http://localhost:11434/api/generate" -Method POST -Body $body -ContentType "application/json" $response.response /POWERSHELLSCRIPT This is all you need to integrate local AI into AdvantageBuilder. This helper uses System.Speech to speak the generated fairy tale aloud. POWERSHELLSCRIPT Add-Type -AssemblyName System.Speech Create synthesizer $synth = New-Object System.Speech.Synthesis.SpeechSynthesizer $synth.SelectVoice $ args.Voice $synth.Speak $ args.TextToSpeech /POWERSHELLSCRIPT AdvantageBuilder’s WinFormsHelper can also build a UI for selecting voices. AdvantageBuilder is designed for multi‑runtime orchestration : In this workflow: All inside one macro. This is the kind of automation that normally requires multiple tools, but AdvantageBuilder handles it natively. This architecture can power: If you want to explore local AI without cloud dependencies, this setup is a great starting point. See the entire workflow — including the helpers, narration, and macro execution — in the video: