π Language | θ―θ¨ιζ©οΌδΈζ | English
1. Rust Node Enhancements
- β
Dual Executable Detection:
start.batandstart.shnow detect both main program and listener executables separately - β
Smart Compilation: Automatically triggers
cargo build --releaseonly when either executable is missing - β Direct Execution: Skips compilation when both executables exist, directly launching the listener
- β
Delayed Expansion Support: Windows batch scripts now use
setlocal enabledelayedexpansionfor proper variable handling - β
Multi-Level Config Search: Both
main.rsandlistener.rssearch forconfig.jsonin three locations (target/release β target β project root) - β Full Path Invocation: Listener calls main program using complete path to avoid working directory issues
- β
Auto-generated output.json: New nodes now include an initial
output.jsonfile with{"code":0,"data":null}
2. Python Node Enhancements
- β
Auto-generated requirements.txt: New nodes include a template
requirements.txtwith commented examples - β
Cross-Platform Dependency Management: Both Windows (
start.bat) and Linux/macOS (start.sh) now support automatic dependency detection and installation - β
UTF-8 Encoding Support: Fixed encoding issues when reading
requirements.txton Windows (previously failed with GBK errors) - β Smart Dependency Detection: Filters out comments and empty lines before checking/installing dependencies
- β Graceful Fallback: Installation failures show warnings but don't prevent node startup
Rust Nodes:
- Fixed Cargo.toml package naming issue (changed from
"1"to proper node name) - Fixed binary filename references in startup scripts
- Fixed configuration file path resolution in both listener and main programs
- Removed unused imports causing compiler warnings
Python Nodes:
- Fixed UTF-8 encoding handling in dependency detection logic
- Ensured consistent behavior between Windows and Linux/macOS startup scripts
- Updated node creation scripts with comprehensive error handling
- Added clear usage instructions in generated
requirements.txttemplates - Improved logging messages in startup scripts with emoji indicators
BNOS (Bionic Neural Network Operating System) is a general-purpose modular execution engine based on bionic neural networks. The system adopts a brain-inspired architecture where multiple collaborative nodes are combined to build various application systems. It can be used for plugin-based systems, automation pipelines, task scheduling, edge computing, microservices, and other scenarios, as well as for building AI agents. Each node is the smallest execution unit in the system (similar to neurons or functional modules in the brain), and multiple nodes communicate and collaborate through JSON files to jointly realize complex business logic and processing capabilities.
This system draws inspiration from the core characteristics of biological neural networks, mapped to general-purpose modular execution scenarios:
- Functional Nodes (Neurons): Each node functions like a neuron or functional module in the brain, responsible for specific subtask processing
- Node Collaboration (Neural Circuits): Multiple nodes connect through data files, forming a collaboration network within the system
- Attention Mechanism: Task filtering based on rules simulates the attention focusing mechanism of nodes
- Duplicate Processing Prevention: Automatically marks processed tasks to avoid nodes repeatedly executing the same operations (improves efficiency)
- Modular Design: Flexibly build various application systems with complex capabilities by combining nodes with different functions
BNOS does not require all nodes to support high concurrency, but adopts a brain-inspired architecture:
- High-Performance Node Implementation: High concurrency and high-performance requirements (such as LLM inference, large-scale computing, high-frequency access) are implemented only within individual specialized nodes
- Flexible Technology Stack: These nodes can freely use multi-threading, multi-processing, coroutines, third-party engines, and other technologies without framework restrictions
- Lightweight Node Stability: Other nodes are only responsible for task perception, attention filtering, decision scheduling, and result storage, maintaining lightweight stability
- Minimalist Communication: Inter-node communication is achieved through files, avoiding the complexity of distributed systems
- Multi-Language Support: Nodes can be implemented in different languages (Python, Rust, C++, etc.) based on performance requirements, all communicating through unified JSON protocol
This architecture makes the system both simple and stable, while enabling extreme performance in critical nodes.
Upper Task (upper_data.json)
β
Listener (listener.py) β Attention Filtering (node attention mechanism)
β
Node Processing Logic (main.py) β Functional Unit Execution
β
Output to Next Node (output.json) β Inter-Node Communication
- listener.py / listener.rs: Node listener responsible for monitoring upper tasks, executing attention filtering, and calling node processing logic
- main.py / main.rs: Node processing logic implementing execution logic for specific functional units within the agent
- config.json: Node configuration file defining node name, listening path, attention rules, etc.
- packet.py / packet.rs: Data packet structure definition file (inter-node communication format)
- create_node.py / rust_create_node.py: Node creation tools that automatically generate complete node structures (Python/Rust)
- Multi-Language Support: Supports Python, Rust, and other language implementations, all using unified JSON communication protocol
- π Environment Isolation: Each node has its own independent Python virtual environment (venv), ensuring independence of functional units within the system
- π― Attention Mechanism: Supports precise task filtering based on field values; nodes only focus on qualifying tasks (simulates attention focusing)
- π Duplicate Processing Prevention: Automatically marks processed tasks to avoid nodes repeatedly executing the same operations (improves system efficiency)
- π Logging System: Comprehensive node activity logging with both file and console output for tracking system behavior
- π Modular Construction: Provides node generator for one-click creation of standardized functional nodes, enabling rapid combination to build various application systems
- π» Cross-Platform: Supports Windows, Linux, and macOS systems
- π General-Purpose Workflow Orchestration: Supports building complex workflows, data pipelines, microservice components, etc. by combining multiple nodes
- π Pluggable Design: Node logic is independently encapsulated, allowing easy replacement, upgrade, or addition of new functional nodes to flexibly adjust system capabilities, suitable for plugin systems, automation toolchains, and other scenarios
bnos/
βββ data/
β βββ upper_data.json # Upper task data file (task source)
βββ node_python_demo/ # Python example node (recommended for rapid development)
β βββ venv/ # Independent virtual environment
β βββ logs/ # Log directory
β β βββ listener.log # Node activity log
β βββ config.json # Node configuration (attention parameters)
β βββ listener.py # Listener program (task receiver)
β βββ main.py # Node processing logic (functional unit execution)
β βββ packet.py # Data packet definition (communication format)
β βββ output.json # Output data file (node output)
β βββ start.bat # Windows startup script
βββ node_rust_demo/ # Rust example node (recommended for high performance)
β βββ src/ # Rust source code
β β βββ main.rs # Main processing logic
β β βββ listener.rs # Listener and self-healing logic
β β βββ packet.rs # Data packet definition
β βββ Cargo.toml # Rust project configuration
β βββ logs/ # Log directory
β β βββ listener.log # Node activity log
β βββ config.json # Node configuration (attention parameters)
β βββ output.json # Output data file (node output)
β βββ start.bat # Windows startup script
β βββ start.sh # Linux/macOS startup script
βββ python_create_node.py # Python node creation tool
βββ rust_create_node.py # Rust node creation tool
βββ README.md # Project documentation
For Python Nodes:
- Python 3.6+
- pip (for creating virtual environments)
For Rust Nodes:
- Rust toolchain (rustc, cargo)
- Verify installation:
rustc --versionandcargo --version
- Run the node creation tool in the project root directory:
python python_create_node.py- Enter the node name (e.g., data_processor, api_handler, task_scheduler), and the system will automatically generate:
- Complete node directory structure
- Independent Python virtual environment
- Standard configuration file
- Startup scripts (Windows:
start.bat/ Linux:start.sh)
- Run the Rust node creation tool:
python rust_create_node.py- Enter the node name, and the system will automatically generate:
- Complete Rust project structure
- Cargo.toml configuration
- Source code templates (main.rs, listener.rs, packet.rs)
- Startup scripts with auto-build capability
Edit the config.json file:
{
"node_name": "data_processor", // Node name (functional unit ID)
"listen_upper_file": "../data/upper_data.json", // Path to upper task file (input channel)
"output_file": "./output.json", // Output file path (output channel)
"filter": { // Attention filtering rules (attention mechanism)
"type": "data_task"
},
"output_type": "data_result" // Output data type identifier
}For Python Nodes: Implement the process() function in main.py:
def process(data):
"""Process input task and return results (functional unit execution)"""
value = data.get("data", 0)
return float(value) + 1For Rust Nodes: Implement the process() function in src/main.rs:
fn process(data: &serde_json::Value) -> Option<serde_json::Value> {
// Implement your business logic here
let input = data.get("data")?;
// Process data...
let result = /* your processing logic */;
Some(result)
}Python Node:
Windows:
cd node_python_demo
start.batLinux/macOS:
cd node_python_demo
chmod +x start.sh
./start.shRust Node:
Windows:
cd node_rust_demo
start.batLinux/macOS:
cd node_rust_demo
chmod +x start.sh
./start.shThe Rust node will automatically build the project on first run or when source code changes are detected.
| Field | Type | Description | Example |
|---|---|---|---|
node_name |
string | Unique node identifier (functional unit ID) | "data_processor" |
listen_upper_file |
string | Upper task file path (relative or absolute, input channel) | "../data/upper_data.json" |
output_file |
string | This node's output file path (output channel) | "./output.json" |
filter |
object | Attention filtering rules, key-value pair matching (attention mechanism) | {"type": "data_task"} |
output_type |
string | Output data type identifier (result type) | "data_result" |
- If
filteris an empty object{}, the node processes all tasks (broad attention) - If filtering rules are configured, tasks are processed only when they contain all specified fields with exact value matches (focused attention)
- Example:
{"type": "data_task"}means the node only focuses on tasks withtypefield value of"data_task"
Input Task Packet (upper_data.json):
{
"type": "data_task",
"data": 153,
"_processed_data_processor": true
}Output Result Packet (output.json):
{
"code": 0,
"type": "data_result",
"data": 154
}For Python Nodes: Add required Python packages to the node's requirements.txt file:
requests==2.28.0
numpy==1.23.0
openai==1.0.0
Then activate the virtual environment and install:
# Windows
venv\Scripts\activate
pip install -r requirements.txt
# Linux/macOS
source venv/bin/activate
pip install -r requirements.txtFor Rust Nodes: Add dependencies to Cargo.toml:
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
chrono = "0.4"
# Add other dependencies...Then build the project:
cargo build --release- View Logs: Check
logs/listener.logto understand node operation status (internal agent activity monitoring) - Monitor Data: Observe changes in
upper_data.jsonandoutput.json(internal agent signal flow tracking) - Test Attention: Modify the
filterrules inconfig.jsonto verify task filtering (attention adjustment)
[2026-04-24 17:26:11] [INFO] β
This is my task, starting processing
[2026-04-24 17:26:11] [INFO] β
Processing complete | Marked: _processed_perception_node
[2026-04-24 17:26:12] [ERROR] β Task packet format error
- Task Reception:
listener.pycontinuously monitors theupper_data.jsonfile (node receives tasks from upstream nodes) - Attention Filtering: Determines whether to process the task based on
filterrules inconfig.json(node attention focusing) - Duplicate Check: Checks if the task has been processed by the current node (via
_processed_<node_name>marker, avoiding duplicate execution) - Node Processing: Calls
main.pyto execute node functional logic, passing JSON task as command-line arguments (functional unit execution) - Output Results: Writes processing results to
output.json(node output, passed to downstream nodes) - Mark Completion: Adds processing markers to
upper_data.jsonto prevent duplicate processing (task completion marking)
- JSON Format: Ensure all JSON files are properly formatted, otherwise parsing errors will occur
- File Permissions: Ensure nodes have read/write permissions for data files
- Virtual Environment: Each node must use an independent virtual environment to avoid dependency conflicts
- Concurrency Safety: The current version does not support running multiple instances of the same node simultaneously
- Path Configuration: Paths in configuration files can be relative or absolute
- System Design: When designing systems, reasonably combine multiple nodes to form complete processing capabilities
As a general-purpose modular execution engine, BNOS is suitable for the following scenarios:
- π Modular Plugin Systems: Build scalable plugin architectures through node composition
- π Data Pipelines: Construct automated pipelines for data processing, transformation, and analysis
- β° Task Scheduling: Implement distributed scheduling and execution of complex tasks
- π Edge Computing: Deploy lightweight node networks on edge devices
- ποΈ Microservices: Build node-based microservice components and API gateways
- π οΈ Automation Toolchains: Create CI/CD, testing, deployment, and other automation toolchains
- π€ AI Agents: Build multi-node collaborative AI agent systems (perception, reasoning, decision nodes, etc.)
- π§ Brain-Inspired Computing Experiments: Conduct research experiments in brain-inspired computing and neural network simulation
- β‘ High-Performance Computing: Use Rust nodes for compute-intensive tasks requiring maximum performance
A: Check the following:
- Confirm that
filterrules are correctly configured (attention settings) - Check
logs/listener.logfor filtering logs - Verify that
upper_data.jsonformat is correct
A: Manually delete the _processed_<node_name> field from upper_data.json (clear node memory)
A: Ensure Python is installed and the python -m venv command is available
A: Create multiple functional nodes (such as data processing nodes, business logic nodes, API nodes, etc.), configure their listen_upper_file and output_file to form collaborative workflows, jointly constituting a complete application system. It can also be used to build AI agents by combining perception nodes, reasoning nodes, decision nodes, etc. to implement agent functionality.
A:
- Choose Python when: Rapid prototyping, easy debugging, rich ecosystem libraries needed, moderate performance requirements
- Choose Rust when: Maximum performance required, memory safety critical, low-latency processing, production environment stability
A: Yes! All nodes communicate through standardized JSON files regardless of implementation language. You can freely combine Python and Rust nodes in the same workflow.
- Background Process Detection: GUI now detects nodes running in background from previous sessions via
.pidfiles - Process Health Check: Polls running processes every 3 seconds; crashed nodes auto-update to stopped status
- Startup Scripts Overhaul: Both
start.batandstart.shnow support--no-pauseflag,start /b/nohup &background launch, and automatic.pidwriting - Node Generator Development Guidelines: Comprehensive guide for creating new language node generators (Node_Generator_Guidelines_EN.md | θηΉηζε¨εΌεεε.md)
- Fixed
subprocess.PIPEbuffer deadlock by switching toDEVNULL - Fixed start scripts blocking foreground execution
- Fixed cross-session process state loss
This project is licensed under the MIT License.
Contributions are welcome! Please feel free to submit Pull Requests or Issues.
Developed & Designed by Ahdong&Shouey Team Last Updated: 2026-05-21