Welcome to the GenAI AgentOS framework! This guide walks you through everything you need to start building, registering, and running your own AI agent with the GenAI protocol.
Before you begin, make sure the following tools are installed:
- Docker
- Python 3.10+
- Git
- uv — a fast Python package manager (optional but recommended)
- ngrok for exposing local ports (optional for deployment)
📂 Open your terminal and run:
git clone https://github.com/genai-works-org/genai-agentos.git
cd genai-agentos⚙️ Set up environment variables:
cp .env-example .envThis command will create the .env file which is mandatory for running AgentOS. Initially, the .env file contains commented variables.
💡 You do not need to uncomment any variables to run the platform or register your agents. However, if you want to use your own configuration, you can uncomment and update the values as needed.
🐳 Make sure Docker is running.
docker-compose up --buildYou can also use:
make upOnce started, open your browser and go to http://localhost:3000. You should see the login form UI, which means AgentOS is ready to use!
🧠 Open this source code in any code editor that supports Python. Then, to create and register an agent, navigate to the cli directory. You can also check the README.md inside the cli folder for a list of supported commands.
You can create a user either from the terminal or using the UI.
📌 To use terminal:
python cli.py signup -u [username]You will be asked to enter a password.
python cli.py login -u [username] -p [password]You can also use these credentials to log in from the UI.
python cli.py register_agent --name <agent_name> --description "<agent description>"This registers your agent. As a result, you’ll see an agents directory created inside the cli folder. It includes the agent’s Python script and uv.lock file. Most of the setup is done automatically.
💡 Note: You don't need to create agents strictly in the cli folder. You can create your agent anywhere you like, as long as you have a valid JWT token.
Navigate to the agent folder:
cd agents/<agent_name>Open the generated Python file and put some logic for your agent. You can also refer to example agents here: Example Agents Repository.
Run your agent using one of the following commands:
uv run <agent_file>.pyOr if you’ve already installed all packages:
python <agent_file>.pyYou will see a message that the agent is running. Now, open the UI, log in using the credentials you created. Navigate to the Agents tab and you'll see your newly created agent.
You can check the example agents that are included in the /genai_agents_example directory.
To run one:
- Go to the UI and open the Agents tab.
- Click Generate Token and copy the JWT token.
- Open one of the example agents in
genai_agents_exampleand paste the token into thejwt_tokenfield. - From terminal:
cd genai_agents_example/<your_desired_agent>
uv run main.py📌 For example:
cd genai_agents_example/get_current_date_agent
uv run main.pyThis will both install dependencies and run the agent. And here you go!
To make the agent functional, create a model from the UI:
- Go to the Settings tab.
- Enter your OpenAI API key.
- Click the plus sign to create a model.
- Name your model.
- For Model, type:
gpt-4o. - Click Save.
You're ready to go! Now go to the Chat tab, select the model, and start prompting your agent! 🤖
Ngrok can be used to expose the local WebSocket endpoint.
Install ngrok:
-
macOS (Homebrew):
brew install ngrok/ngrok/ngrok
-
Linux:
sudo snap install ngrok
Authenticate ngrok:
-
Sign up or log in at the ngrok dashboard.
-
Go to the Your Authtoken section and copy the token.
-
Run:
ngrok config add-authtoken <YOUR_AUTH_TOKEN>
Start a tunnel to local port 8080:
ngrok http 8080Copy the generated WebSocket URL.
🔁 Important: When using the ngrok URL for your ws_url, make sure to:
- Replace
httpswithwss. - Append
/wsat the end of the URL.
✅ Example: If ngrok gives you:
https://abc123.ngrok.io
Then use:
wss://abc123.ngrok.io/ws
-
Create a new Colab notebook.
-
Install the required packages:
!pip install loguru !pip install genai-protocol
-
Paste your agent code into a cell, including:
- your JWT token (generate it from the AgentOS UI)
- your ngrok-exposed links as with this template.
Here is a sample template with a simple get_current_date agent:
from datetime import datetime
from genai_session.session import GenAISession
from loguru import logger
import nest_asyncio
nest_asyncio.apply()
session = GenAISession(jwt_token="", ws_url="Ngrok Router service URL")
@session.bind(name="get_current_date", description="Return current date")
async def get_current_date(agent_context):
return datetime.now().strftime("%Y-%m-%d")
async def main():
await session.process_events()
await main()💡 This is great for testing your logic remotely, but not recommended for running full WebSocket sessions.
Enjoy hacking! 🚀