Custom Node
TLDR: Custom nodes let you write Python code for behaviors that standard nodes can't handle. The properties panel has three tabs: Config, Code, and AI Assist. Pro feature.
Config Tab
The Config tab has two sections:
Node Identity
- Custom Type Name — a text field for naming your custom behavior (e.g., "TriageStation", "QualityCheck"). This label appears on the canvas.
- Base Behavior Type — five buttons to choose the underlying behavior:
| Base Type | Color | Behavior |
|---|---|---|
| Processor | Green | Processes agents with service time |
| Source | Blue | Generates new agents |
| Delay | Amber | Delays agent movement |
| Batcher | Cyan | Batches agents together |
| Assembler | Purple | Combines multiple agents |
Status
Shows whether code has been defined:
- Green checkmark + "Code Defined" + line count (e.g., "12 lines of Python")
- Amber warning + "No Code Yet" + hint to use the Code tab or AI Assist
Code Tab
Quick Templates
Four starter templates to get you going:
- Basic Process — simple processing with timeout
- Conditional Routing — route based on an attribute
- Random Delay — variable processing time
- Attribute Modifier — modify agent attributes
Click a template to preview it, then insert it into the editor.
Python Code Editor
A dark-themed text area where you write your process(env, entity) function. The editor shows the function signature process(env, entity) and language label "Python" in the header.
def process(env, entity):
# Your logic here
yield env.timeout(5)
return entity
The env parameter is a SimPy environment. Use yield env.timeout(time) to simulate delays. The entity has attributes you can read and modify.
AI Assist Tab
Don't know Python? Describe what you want in plain English and let AI generate the code.
- Type a description in the text area (e.g., "Process entities faster if their priority is high")
- Click "Generate Python Code"
- The generated code appears in the Code tab for you to review and edit
Start with standard nodes — Entry, Processor, Separator, Assign, etc. cover most scenarios. Only use Custom when you need logic that can't be achieved with the built-in nodes. Most simulations don't need custom code.