
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
@loopstack/chat-example-workflow
Advanced tools
A module for the Loopstack AI automation framework.
This module provides an example workflow demonstrating how to build an interactive chat interface with an LLM.
The Chat Example Workflow shows how to create a conversational assistant that processes user messages and generates responses using an LLM. It demonstrates the core patterns for building chat-based applications in Loopstack.
By using this workflow as a reference, you'll learn how to:
This example is useful for developers building chatbots, virtual assistants, or any conversational AI interface.
You can add this module using the loopstack cli or via npm.
loopstack add (recommended)loopstack add @loopstack/chat-example-workflow
This command copies the source files into your src directory.
npm installnpm install --save @loopstack/chat-example-workflow
Use npm install if you want to use and maintain the module as node dependency.
Set your OpenAI API key as an environment variable:
OPENAI_API_KEY=sk-...
This step is automatically done for you when using the
loopstack addcommand.
ChatExampleModule to the imports of default.module.ts or any other custom module.ChatWorkflow workflow to your workspace class using the @InjectWorkflow() decorator.See here for more information about working with Modules and Workspaces
The workflow begins by creating a hidden system message that defines the assistant's behavior:
- id: greeting
from: start
to: ready
call:
- tool: createDocument
args:
document: aiMessageDocument
update:
meta:
hidden: true
content:
role: system
parts:
- type: text
text: |
You are a helpful assistant named Bob.
Always tell the user your name.
When the workflow reaches the ready state, it calls the LLM to generate a response based on the conversation history:
- id: prompt
from: ready
to: prompt_executed
call:
- tool: aiGenerateText
args:
llm:
provider: openai
model: gpt-4o
messagesSearchTag: message
assign:
llmResponse: ${ result.data }
The workflow defines a custom UI action that allows users to send messages:
ui:
actions:
- type: custom
transition: user_message
widget: prompt-input
enabledWhen:
- ready
options:
label: Send Message
User messages are handled through a manually triggered transition that captures the input payload:
- id: user_message
from: waiting_for_user
to: ready
trigger: manual
call:
- tool: createDocument
args:
document: aiMessageDocument
update:
content:
role: user
parts:
- type: text
text: ${ transition.payload }
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 AiMessageDocumentAuthor: Jakob Klippel
License: Apache-2.0
FAQs
An example chat workflow to interact with an LLM.
The npm package @loopstack/chat-example-workflow receives a total of 391 weekly downloads. As such, @loopstack/chat-example-workflow popularity was classified as not popular.
We found that @loopstack/chat-example-workflow demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.