A module for the Loopstack AI automation framework.
This module provides a complete example demonstrating how to implement and use custom tools in a Loopstack workflow.
Custom tools are the building blocks of Loopstack automations. This module serves as a hands-on reference for developers learning how to extend Loopstack with their own functionality.
By exploring this example, you'll understand:
- How to create tools that perform specific tasks within workflows
- The difference between stateless and stateful tools
- How to use dependency injection to keep tools modular and testable
- How to wire tools into workflows using YAML configuration
- How to structure and export a reusable module
This is a great starting point before building your own custom tools.
Create a new Loopstack project if you haven't already:
npx create-loopstack-app my-project
cd my-projectStart Environment
cd my-project
docker compose up -dloopstack add @loopstack/custom-tool-example-moduleThis copies the source files into your src directory.
Using the
loopstack addcommand is a great way to explore the code to learn new concepts or add own customizations.
Add CustomToolModule to your default.module.ts (included in the skeleton app) or to your own module:
import { Module } from '@nestjs/common';
import { LoopCoreModule } from '@loopstack/core';
import { DefaultWorkspace } from './default.workspace';
import { CustomToolModule } from './custom-tool-example-module';
@Module({
imports: [LoopCoreModule, CustomToolModule],
providers: [DefaultWorkspace],
})
export class DefaultModule {}Add the workflow to your default.workspace.ts or your own workspace:
import { WorkspaceBase } from '@loopstack/core';
import { Injectable } from '@nestjs/common';
import { BlockConfig, Workflow } from '@loopstack/common';
import { CustomToolExampleWorkflow } from './custom-tool-example-module/workflows';
@Injectable()
@BlockConfig({
config: {
title: 'Default Workspace',
},
})
export class DefaultWorkspace extends WorkspaceBase {
@Workflow() customToolExample: CustomToolExampleWorkflow;
}npm run start:devOpen localhost:3000 and execute the workflow in the Loopstack Studio.

