LLM prompts that compile, not just chat
Because treating prompts as copy-paste strings breaks automation, repeatability, and structured extraction.

What it does
GenAIScript is a JavaScript/TypeScript toolkit that treats LLM prompts as code. You write scripts using template tags like $ and helpers like def() to assemble dynamic prompts, ingest files, and dispatch requests to OpenAI, Azure, Anthropic, GitHub Models, or local Ollama instances. The runtime parses structured outputs, extracts generated files, and manages context windows automatically.
The interesting bit
Instead of static strings, you get an imperative programming model: register JavaScript functions as LLM tools, chain multi-step LLM pipelines, run sandboxed Python or Docker containers, and compose reusable agents—all inside ordinary script files that live in your repo.
Key highlights
- Prompts are code: assemble context with variables, file contents, and Zod schemas using template literals.
- File ingestion: built-in parsers for PDF, DOCX, CSV, XLSX, plus video transcription and frame extraction.
- Agent construction kit: combine tools and system prompts into agents (like a
gitagent) that other scripts invoke as tools. - CI-native: CLI and API support with GitHub Actions and Azure DevOps integration for PR reviews and automated checks.
- Safety and evals: built-in content safety hooks, responsible AI system prompts, and test frameworks via promptfoo.
Verdict
Best for teams automating repetitive LLM tasks—bulk document processing, structured data extraction, or CI checks—who want git history instead of a chat log. Skip it if you just need an occasional one-off answer.
Frequently asked
- What is microsoft/genaiscript?
- Because treating prompts as copy-paste strings breaks automation, repeatability, and structured extraction.
- Is genaiscript open source?
- Yes — microsoft/genaiscript is open source, released under the MIT license.
- What language is genaiscript written in?
- microsoft/genaiscript is primarily written in TypeScript.
- How popular is genaiscript?
- microsoft/genaiscript has 2.9k stars on GitHub.
- Where can I find genaiscript?
- microsoft/genaiscript is on GitHub at https://github.com/microsoft/genaiscript.