Formats (TS, YAML, JSON)
Kortyx currently supports all three authoring formats.
| Format | Best for | Notes |
|---|---|---|
| TypeScript | app codebases | best DX, direct node imports |
| YAML | declarative workflow files | human-readable, comments |
| JSON | generated/exported configs | machine-friendly |
TypeScript
TS
import { defineWorkflow } from "kortyx";
import { chatNode } from "@/nodes/chat.node";
export const wf = defineWorkflow({
id: "general-chat",
version: "1.0.0",
nodes: {
chat: { run: chatNode, params: {} },
},
edges: [
["__start__", "chat"],
["chat", "__end__"],
],
});YAML
YAML
id: general-chat
version: 1.0.0
nodes:
chat:
run: ../nodes/chat.node.ts#chatNode
params: {}
edges:
- ["__start__", "chat"]
- ["chat", "__end__"]JSON
JSON
{
"id": "general-chat",
"version": "1.0.0",
"nodes": {
"chat": {
"run": "../nodes/chat.node.js#chatNode",
"params": {}
}
},
"edges": [["__start__", "chat"], ["chat", "__end__"]]
}How loading works in current packages
@kortyx/core/loadWorkflowparsesstring | Buffer | object- JSON text starts with
{/[and is parsed as JSON - otherwise it is parsed as YAML (
js-yaml) @kortyx/runtime/createFileWorkflowRegistryscans these file extensions:.workflow.ts,.workflow.mts,.workflow.js,.workflow.mjs.workflow.json,.workflow.yml,.workflow.yaml