Basic Concepts
Loopstack uses a modular architecture where every component (workflow, document, tool, and workspace) is defined as a reusable, configurable element.
Every component in Loopstack consists of two parts:
- TypeScript Services: Defines data structure, validation rules, capabilities.
- YAML Configuration: Defines the runtime behavior, UI representation, and execution flow
Note, using the separate yaml configs is optional. You can also define the behaviour using the config property in the decorator options following the same schema. However, we recommend using the yaml configuration for better modularity, reusability and readability.
Example
Here’s a minimal example showing the essential components of a workflow:
workflow.ts - Container
@Workflow({
configFile: './config.yaml',
})
export class ClassificationWorkflow {
@Input({
schema: z.object({
message: z.string(),
})
})
args: { message: string }
@InjectDocument() classificationDocument: ClassificationDocument;
@InjectTool() aiGenerateDocument: AiGenerateDocument;
@InjectTool() notifyTool: NotifyTool;
}workflow.yaml - State Machine
transitions:
- id: step1
from: start
to: message_classified
call:
- tool: AiGenerateDocument
args:
response:
document: classificationDocument
prompt: |
Classify the following message:
{{ args.message }}
assign:
classification: ${{ response.data.content }}
- id: notify
from: message_classified
to: end
call:
- tool: notifyTool
args:
message: ${{ args.message }}
priority: ${{ state.classification.priority }}Block Types
Loopstack includes several block types, each serving a specific purpose:
Workspaces: Group related workflows and provide organizational structureWorkflows: Orchestrate processes using state machine transitionsDocuments: Define structured data with validation and UI configurationTools: Encapsulate reusable operations (API calls, transformations, etc.)
Last updated on