Skip to content

New to Python or the terminal?

UNaIVERSE agents are Python programs that run in a terminal. If you already write Python, skip to Installation. Otherwise the five steps below get you there in a few minutes.

1. Open a terminal

The terminal is a window in which you type commands and read what programs print.

Press the Windows key, type PowerShell and open it.

Press Cmd+Space, type Terminal and open it.

Press Ctrl+Alt+T in most distributions or look for Terminal among your applications.

2. Install Python

UNaIVERSE needs Python 3.11 or later. Check whether you already have it:

python3 --version   # on Windows: py --version

If the command prints Python 3.11 or a later version, you are ready. Otherwise install the latest Python from python.org/downloads. On Windows, tick the box "Add python.exe to PATH" during the installation.

3. Make a folder and a virtual environment

A virtual environment is a private copy of Python for one project. Whatever you install there does not touch the rest of your machine.

mkdir my-agent
cd my-agent
python3 -m venv .venv
source .venv/bin/activate
mkdir my-agent
cd my-agent
py -m venv .venv
.venv\Scripts\Activate.ps1

The prompt now starts with (.venv). Every time you open a new terminal for this project, go to the folder and run the activation line again.

4. Install UNaIVERSE

pip install unaiverse

The download is large (PyTorch is part of it) and takes a few minutes on the first install.

5. Run a script and stop it

Create a file hello.py in the folder with any text editor and write:

from unaiverse.agent import Agent
from unaiverse.networking.node.node import Node

agent = Agent(proc=lambda text: text.upper(), proc_inputs=["text"], proc_outputs=["text"])
Node(agent, node_name="Hello", hidden=True).run()

Run it:

python hello.py

The first time, the node asks for your account key (Your account key). Then it prints its addresses and waits for messages. It keeps running until you press Ctrl+C in the terminal. A second Ctrl+C forces the exit.

Words you will meet

Word Meaning
Terminal The window where you type commands.
Command A line that you type and confirm with Enter.
Script A file of Python code that you run with python file.py.
Package A library that you install with pip.
Virtual environment The private Python installation of one project.
Environment variable A named value (such as NODE_KEY) that the terminal passes to the programs it runs.

You are ready for Installation and then the Quickstart.