Jaiph (jaiph)

raw JSON →
0.7.0 verified Fri May 01 auth: no javascript

Jaiph is an open-source composable scripting language and runtime for defining and orchestrating AI agent workflows. Version 0.7.0 is the latest stable release, with ongoing development and breaking changes expected. Jaiph allows users to write `.jh` files that combine prompts, rules, scripts, and workflows into executable pipelines. The CLI parses source into an AST, validates references at compile time, and the Node workflow runtime interprets the AST directly. Key differentiators include a dedicated language for AI workflows, built-in test runner, sandboxing, and reporting capabilities. Jaiph is designed to be installed via npm or a curl script, and includes a CLI for running, testing, formatting, and reporting on workflows.

error Error: Cannot find module 'jaiph'
cause Importing from the root instead of a subpath export.
fix
Use correct import path: import { parse } from 'jaiph/parser';
error TypeError: jaiph.run is not a function
cause Using older API where run was a method; now it's a CLI command.
fix
Run 'jaiph run workflow.jh' in the terminal, not via API.
error SyntaxError: Unexpected token '?'
cause Missing shebang or parser version mismatch.
fix
Ensure .jh file starts with '#!/usr/bin/env jaiph' and install jaiph globally.
error Error: Failed to resolve import './tools/security.jh'
cause Relative import path is incorrect or file doesn't exist.
fix
Check that the imported file exists and the path is correct relative to the source file.
breaking Breaking changes in minor versions as API evolves
fix Pin exact version in package.json and check changelog before upgrades.
gotcha Import paths require subpath exports (e.g., 'jaiph/parser'), not root
fix Use 'jaiph/parser', 'jaiph/runtime', etc. instead of 'jaiph'.
deprecated Old CLI command 'jaiph run' without arguments will be removed in v1
fix Always provide a workflow file or task argument.
gotcha Jaiph files require shebang for direct execution on Unix
fix Add '#!/usr/bin/env jaiph' as the first line of .jh files.
gotcha ESM-only; CommonJS require does not work
fix Use ES module imports (import) or async import() dynamic imports.
npm install jaiph
yarn add jaiph
pnpm add jaiph

Define a workflow with a script, rule, and prompt in Jaiph language.

#!/usr/bin/env jaiph

import "tools/security.jh" as security

script check_deps = "test -f \"package.json\""

rule deps_exist() {
  if not run check_deps() {
    fail "Missing package.json"
  }
}

workflow default(task) {
  ensure deps_exist()
  const ts = run script() "date +%s"
  prompt "Build the application: ${task}"
  ensure security.scan_passes()
}

// Run with: ./main.jh "add user authentication"