@flowforgejs/sdk
v0.1.4
Published
FlowForge SDK — Define type-safe workflows in TypeScript
Readme
@flowforgejs/sdk
The core workflow DSL for FlowForge. Define nodes with typed inputs and outputs using Zod schemas, then compose them into declarative workflows with the fluent builder API.
Key exports: defineNode(), defineAgentNode(), workflow()
Install
npm install @flowforgejs/sdkQuick Example
import { defineNode, workflow } from '@flowforgejs/sdk';
import { z } from 'zod';
const fetchUser = defineNode({
name: 'fetch-user',
input: z.object({ userId: z.string() }),
output: z.object({ name: z.string(), email: z.string() }),
async run(ctx) {
// node implementation
},
});
const greetUser = defineNode({
name: 'greet-user',
input: z.object({ name: z.string() }),
output: z.object({ message: z.string() }),
async run(ctx) {
// node implementation
},
});
const myWorkflow = workflow('onboarding')
.addNode(fetchUser)
.addNode(greetUser)
.connect('fetch-user', 'greet-user')
.build();