The UNaIVERSE project (dev name was NARNIAN, which is the name of this repo, now not used anymore, stay tuned!) promotes a nature-inspired framework that simulates an evolving ecosystem of agents that learn over time by interacting with each other and with humans. Designed for flexibility and extensibility, it enables researchers and developers to study dynamic learning and teaching processes in a customizable simulation world, that might be directly linked to "reality". Agents capture, generate, and share real-time data streams and adapt their capabilities (their Model) in function of the information to which they are exposed. Their interactions patterns are handled by an architectural component called Behavior.
This is a pre-release version with no network functionalities (dev name was NARNIAN). Stay tuned for the first release of the UNaIVERSE platform!
-
Agents
UNaIVERSE is a dynamic set of worlds populated by Agents, where an Agent is an entity that can interact with the environment and with the other agents living in it. Agents can be human or artificial, and they can have different levels of intelligence and different learning capabilities. Agents can be controlled by the user, or they can be controlled by the framework itself. In the current implementation, each agent is represented by its Finite State Machine (FSM) which describe its Behavior, and by a neural Model that determines how it reacts to perceptual stimuli. The Model is capable of generation and of prediction of descriptors of the generated or given data. -
Streams
Real-time data flows representing sensory information and descriptors from the environment. -
Environment
The simulation world where agents and streams coexist. The enviroment can be a physical world, a virtual world, or a combination of both. The environment can be static or dynamic, and it can have different levels of complexity. The environment can be controlled by the user, or it can be controlled by the framework itself.
Install a python enviroment ensuring than you have python 3.10 or higher.
conda create -n unaiverse python=3.10
conda activate unaiverseClone the repository:
git clone https://github.com/mela64/narnian
cd narnianImportant
Install graphviz for visualizing the FSMs (not strictly required for running simulations):
sudo apt install graphviz # For Sudoers
conda install -c conda-forge graphviz # OtherwiseInstall the dependecies with pip:
pip install -r requirements.txtTry one of the examples:
python sandbox_example.py # A simple example of a UNAiVERSE (in its NARNIAN pre-release fashion) simulation.UNaIVERSE (in its NARNIAN pre-release instance) is structured as follows, where we emphasized with square brakets those files that will be extended when creating an instance of worlds (see below):
narnian/
├── narnian/
│ ├── __init__.py # Package initializer
│ ├── [agents.py] # An agent, with its basic skills in communication and interaction
│ ├── attributes.py # Manages attributes and labels for streams
│ ├── [environment.py] # Defines the environment where agents and streams interact
│ ├── fsm.py # Implements Finite State Machines for agent behaviors
│ ├── [model.py] # Contains the structure of the core models of the agents (generators, predictors)
│ ├── server.py # Manages a server which makes a world accessible through a web app
│ ├── [streams.py] # Handles real-time data streams
A basic instance of the Narnian framework is available in the basic folder. It contains an example of a simulated environment where student-like agents named Mario and Luigi and a teacher-like agent named Dr. Greeen coexist. The teacher exploits information from the environment to teach the students. After one or more lectures, the students are evaluated on their capabilities, and, in some cases, the teacher may decide if a student is ready to become a new teacher or if it needs more assistance.
narnian/
├── basic/
│ ├── utils/
│ │ ├── hl_utils.py
│ ├── [basic_agent.py] # An agent living in a basic environment
│ ├── [basic_environment.py] # The basic enviroment
│ ├── [basic_model_*.py] # Neural models that can be used in the basic envirnment
│ ├── [basic_streams.py] # Streams that can be used in the basic environment
The root folder of the repository includes example simulations that showcase how to run the basic:
Animal School is a simulation scenario (what we call "sandbox") built using the basic framework that mimics an educational ecosystem. In this scenario, a virtual "school" is created where a teacher agent instructs and evaluates student agents using real-time data streams composed of animal images.
At its core, the scenario emulates a classroom setting where:
-
A Teacher Agent ("Dr. Green") collects general information from the environment, prepares an exam using the aggregate data stream, and then embarks on a teaching process. The teacher sets preferred image streams for focused instruction and evaluates student performance.
-
Student Agents ("Mario" and "Luigi") adopt the teacher’s behavior patterns, engage with the provided data, and respond to teaching instructions. Their interactions simulate a typical learning process where they are guided, assessed, and eventually promoted based on their performance.
To execute the Animal School sandbox, run the following command:
python sandbox_animal_school.pyIt will start the server for monitoring the simulation in a web browser. Follow the hyperlink provided in the terminal to access the web interface.
Cat Library is a simulation scenario ("sandbox") where a digital "library" of textual data forms the basis for an educational ecosystem. In this scenario, agents interact with a stream of tokens—words related to cats. The simulation emulates a teaching and learning environment where the teacher agent compiles a "book" from the token stream, and the student agent learns from that prepared content.
To execute the Cat Library sandbox, run the following command:
python sandbox_cat_library.pySignal School sandbox is a dynamic ecosystem where multiple streams of scalar signal are processed to evaluate learning, generalization, and predictive performance. The simulation involves a teacher agent orchestrating a teaching-evaluation loop over diverse scalar signals, while a student agent adapts and learns to generalize across these signals.
To execute the Signal School sandbox, run the following command:
python sandbox_signal_school.pyCollectionless AI Team - © Stefano Melacci (2025)

