Adding a New Node Type
This guide walks through adding a new node type to Voiceblox. You’ll touch four files.Step 1: Define the node template
Incomponents/builder/nodeTemplates.ts, add a new entry to the nodeTemplates array:
Step 2: Add connection rules
Incomponents/builder/connectionRules.ts, add a rule for your new node:
Step 3: Handle in graph-to-config
Inlib/agent/graph-to-config.ts, add handling in collectAllSteps() to extract your node’s parameters into the ConversationStep:
"my_node" to the StepType union in lib/agent/models.ts:
Step 4: Handle in the agent runtime
Inagent/livekit.ts, add a case in VoicebloxAgent’s onUserTurn() handler (or the StepWatcher if it’s a step-level node) to define the runtime behavior:
Testing
- Restart
pnpm dev - Find your node in the sidebar under its category
- Drag it onto the canvas and verify handles appear correctly
- Try connecting it to adjacent nodes and verify connection rules work
- Add it to a flow and run it in the playground to verify runtime behavior
- Ask the AI generator to add your new node type and verify it generates correctly
Checklist
- Node template added to
nodeTemplates.ts - Connection rules added to
connectionRules.ts -
StepTypeor config type updated inmodels.ts - Parameter extraction added to
graph-to-config.ts - Runtime behavior added to
livekit.tsorstep-watcher.ts - Tested manually in the builder
- Tested in the playground