Node Architecture
BaseNode Class
All nodes inherit fromBaseNode[ConfigType], a generic base class that provides the node lifecycle and interface.
Node Metadata
node_name (str, required)- Unique identifier for the node type
- Use snake_case convention
- Must be globally unique across all nodes
- Display name in UI
- Use Title Case
- Keep concise (2-4 words)
- Groups nodes in palette
- Options:
AIText,Agent,Logic,Data,Integration,InputOutput,Utility
- Hex color code for node appearance
- Use brand colors or category-standard colors
- Icon URL (PNG/SVG)
- Displayed in node palette and on canvas
- Recommended size: 48x48px
- Whether to show in node palette
- Set to False for deprecated or internal nodes
Defining Inputs and Outputs
Connector Types
Single-Value Connector:Data Types
Noxus supports rich type definitions:Optional Inputs
Node Configuration
Configuration fields allow users to customize node behavior without connections.Configuration Schema
Define a Pydantic model for configuration:Configuration Field Types
ConfigText: Single-line text input ConfigBigText: Multi-line textarea ConfigRichTextVariables: Rich text editor with variable insertion ConfigSelect: Dropdown selection ConfigMultiSelect: Multi-select dropdown ConfigToggle: Boolean switch ConfigNumberSlider: Numeric slider ConfigDictList: Key-value pair list ConfigJsonSchemaBuilder: JSON schema designer ConfigModelSelect: LLM model picker ConfigToolsSelect: Agent tool selectorDynamic Configuration
Generate configuration options dynamically:Implementing Node Logic
The call() Method
Thecall() method is where your node’s logic executes:
Sync vs Async
Nodes can be synchronous or asynchronous: Async (Recommended):- Database queries
- External API calls
- I/O operations
- Pure computation
- Simple transformations
Execution Context
TheExecutionContext provides access to platform resources:
Database Access:
Error Handling
Raising Errors
Raise exceptions to signal errors:Continue on Error
Users can configure nodes to continue on error. Your node should return default values:Timeout Configuration
Nodes can specify dynamic timeouts:List Handling
Nodes automatically handle list iteration when a list output connects to a non-list input. Option 1: Non-List Input (Automatic Iteration):File Handling
Reading Files
Creating Files
Testing Custom Nodes
Unit Tests
Integration Tests
Registering Nodes
Register your custom node with the node registry:Best Practices
Design
Single Responsibility: Each node should do one thing well Composability: Design nodes to work together via connections Clear Naming: Use descriptive names for nodes, inputs, and outputs Consistent Style: Follow existing node conventionsPerformance
Async I/O: Use async for network and database operations Batch Operations: Process batches efficiently when possible Resource Limits: Set appropriate timeouts for long operations Memory Management: Clean up large objects after useError Handling
Descriptive Errors: Provide clear error messages Validation: Validate inputs early Graceful Degradation: Return sensible defaults when possible Logging: Log errors with context for debuggingSecurity
Input Validation: Validate and sanitize all inputs Credential Handling: Never log or expose credentials API Rate Limits: Respect external API rate limits Dependency Security: Keep dependencies updatedAdvanced Topics
Progress Updates
Report progress for long-running operations:Streaming Outputs
Stream outputs for real-time updates:Memory Nodes
Access persistent memory:Example: Complete Custom Node
Building custom nodes extends Noxus with unlimited possibilities. Start with simple nodes and gradually add complexity as you master the patterns.
Node Configuration Guide
Deep dive into configuration field types and dynamic configuration