Skip to content

Promptel

Declarative prompt engineering for production AI applications.

Promptel is a framework for writing sophisticated LLM prompts using a clean, declarative syntax. It's the first Node.js framework with native Harmony Protocol support for multi-channel reasoning.


Why Promptel?

Modern AI applications need sophisticated prompt engineering, but implementing advanced techniques is complex:

  • Chain-of-Thought requires careful step management
  • Multi-channel responses need custom parsing logic
  • Provider switching means rewriting integration code
  • Prompt maintenance becomes difficult at scale

Promptel solves these problems with a declarative approach:

import { executePrompt } from 'promptel';

const result = await executePrompt(`
prompt MathSolver {
  params {
    problem: string
  }

  body {
    text\`Solve: \${params.problem}\`
  }

  technique {
    chainOfThought {
      step("Analyze") { text\`Break down the problem\` }
      step("Solve") { text\`Calculate step by step\` }
      step("Verify") { text\`Check the answer\` }
    }
  }
}
`, { problem: "What is 25% of 240?" });

Key Features

  • Dual Format Support


    Write prompts in .prompt syntax or YAML. Convert between formats seamlessly.

    Format Guide

  • Advanced Techniques


    Built-in Chain-of-Thought, Tree-of-Thoughts, ReAct, and more.

    Techniques

  • Multi-Provider


    Switch between OpenAI, Anthropic, and Groq with consistent APIs.

    Providers

  • Harmony Protocol


    Native support for multi-channel responses with gpt-oss models.

    Harmony


Quick Install

npm install promptel

Set your API key:

export PROMPTEL_API_KEY=your-api-key

Quick Example

import { executePrompt } from 'promptel';

const result = await executePrompt(`
prompt Greeting {
  params {
    name: string
  }
  body {
    text\`Say hello to \${params.name}\`
  }
}
`, { name: "World" });

console.log(result);
import { executePrompt } from 'promptel';

const result = await executePrompt(`
name: Greeting
params:
  name:
    type: string
    required: true
body:
  text: "Say hello to \${params.name}"
`, { name: "World" });

console.log(result);
promptel -f greeting.prompt -p openai --params '{"name":"World"}'

Architecture

flowchart LR
    A[.prompt/.yml] --> B[Parser]
    B --> C[AST]
    C --> D[Executor]
    D --> E[Provider]
    E --> F[LLM]
    F --> G[Response Parser]
    G --> H[Output]

Next Steps