npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@loopstack/prompt-example-workflow

v0.20.6

Published

A simple workflow showing how to integrate an LLM using a simple prompt pattern.

Downloads

457

Readme

@loopstack/prompt-example-workflow

A module for the Loopstack AI automation framework.

This module provides an example workflow demonstrating how to integrate an LLM using a simple prompt pattern.

Overview

The Prompt Example Workflow shows the most basic way to call an LLM in Loopstack—using a simple text prompt. It generates a haiku about a user-provided subject.

By using this workflow as a reference, you'll learn how to:

  • Define workflow input arguments with default values
  • Use the prompt parameter for simple LLM calls
  • Interpolate arguments into prompts using template syntax
  • Access tool results via the runtime object
  • Display LLM responses as documents

This example is the ideal starting point for developers new to LLM integration in Loopstack.

Installation

See SETUP.md for installation and setup instructions.

How It Works

Key Concepts

1. Workflow Input

Define input parameters with default values using @Input:

@Input({
  schema: z.object({
    subject: z.string().default('coffee'),
  }),
})
args: {
  subject: string;
};

Configure the UI form in YAML:

ui:
  form:
    properties:
      subject:
        title: 'What should the haiku be about?'

2. Simple Prompt Pattern

Use the prompt parameter for straightforward LLM calls without conversation history. The tool call is given an id so its result can be referenced later:

- id: prompt
  from: start
  to: prompt_executed
  call:
    - id: llm_call
      tool: aiGenerateText
      args:
        llm:
          provider: openai
          model: gpt-4o
        prompt: Write a haiku about {{ args.subject }}

3. Accessing Results via Runtime

Instead of using assign to save results to workflow state, tool results are accessed through the runtime object. The path follows the pattern runtime.tools.<transitionId>.<toolCallId>.data:

- id: add_response
  from: prompt_executed
  to: end
  call:
    - tool: createDocument
      args:
        document: aiMessageDocument
        update:
          content: ${{ runtime.tools.prompt.llm_call.data }}

The TypeScript class declares the runtime types with the @Runtime() decorator:

@Runtime()
runtime: {
  tools: Record<'prompt', Record<'llm_call', ToolResult<AiMessageDocumentContentType>>>;
};

4. Argument Interpolation

Access workflow arguments in templates using args.<name>:

prompt: Write a haiku about {{ args.subject }}

Dependencies

This workflow uses the following Loopstack modules:

  • @loopstack/core - Core framework functionality
  • @loopstack/core-ui-module - Provides CreateDocument tool
  • @loopstack/ai-module - Provides AiGenerateText tool and AiMessageDocument

About

Author: Jakob Klippel

License: Apache-2.0

Additional Resources