Introduction

AgentOS is a production-ready runtime for autonomous AI agents. It provides built-in memory management, safe tool sandboxing, and multi-provider LLM support.

What is an AI Agent?

An AI agent is an autonomous program that can perceive its environment, make decisions, and take actions to achieve specific goals using large language models (LLMs).

Key Features

  • Multi-provider LLM support (OpenAI, Claude, Gemini, etc.)
  • Interactive chat mode with rich terminal UI
  • Security-first design with command filtering
  • Process management with SQLite backend
  • Optional Docker isolation for safe execution
  • Comprehensive logging and monitoring

Installation

AgentOS can be installed on Linux and Windows systems. Choose your platform below:

Linux

bash
# Clone the repository
git clone https://github.com/agents-os/agentos.git
cd agentos

# Run the installer
python3 install_linux.py

Windows

powershell
# Clone the repository
git clone https://github.com/agents-os/agentos.git
cd agentos

# Run the installer
python install_windows.py

Requirements

  • Python: 3.8 or higher
  • Git: For cloning the repository
  • Docker: Optional, for isolated execution

Quick Start

Get your first agent running in under 5 minutes.

Step 1: Create an Agent Manifest

Create a file named agent.yaml with the following content:

agent.yaml
name: my_assistant
model_provider: github
model_version: openai/gpt-4o-mini
isolated: false

DESTRUCTIVE_COMMANDS:
  - rm
  - sudo
  - rmdir

Step 2: Run Your Agent

bash
agentos run agent.yaml --task "create a Python hello world script"

Step 3: Monitor Your Agent

bash
agentos ps

Configuration

AgentOS uses environment variables for API keys and global settings.

Environment Variables

Create a .env file in your project directory:

.env
# API Keys
GIT_HUB_TOKEN=your_github_token
OPENAI_API_KEY=your_openai_key
CLAUDE_API_KEY=your_claude_key
GEMINI_API_KEY=your_gemini_key
COHERE_API_KEY=your_cohere_key
Security Warning

Never commit your .env file to version control. Add it to your .gitignore.

Logging

Logs are stored in ~/.agentos/logs/:

  • agentos.log - Main system log
  • <agent_name>_<id>.log - Per-agent execution logs

Database

Agent registry is stored in ~/.agentos/runtime.db (SQLite).

Agents

Agents are the core building blocks of AgentOS. Each agent is defined by a manifest file and can perform autonomous tasks.

Agent Lifecycle

Define
Run
Monitor
Complete

Agent States

State Description
running Agent is actively executing tasks
completed Agent finished successfully
failed Agent encountered an error
stopped Agent was manually terminated

Manifests

Agent manifests are YAML files that define an agent's configuration.

Required Fields

Field Type Description
name string Unique agent identifier
model_provider string LLM provider (github, openai, claude, gemini, cohere, ollama)
model_version string Specific model to use

Optional Fields

Field Type Default Description
isolated boolean true Enable Docker sandboxing
DESTRUCTIVE_COMMANDS list default list Commands to block

Complete Example

research_agent.yaml
name: research_assistant
model_provider: claude
model_version: claude-3-5-sonnet
isolated: true

DESTRUCTIVE_COMMANDS:
  - rm
  - rmdir
  - sudo
  - dd
  - mkfs
  - format
  - kill

LLM Providers

AgentOS supports multiple LLM providers out of the box.

Provider Models API Key Variable
GitHub Models openai/gpt-4o-mini, openai/gpt-4o GIT_HUB_TOKEN
OpenAI gpt-4, gpt-4-turbo, gpt-3.5-turbo OPENAI_API_KEY
Anthropic claude-3-5-sonnet, claude-3-opus CLAUDE_API_KEY
Google gemini-2.0-flash, gemini-pro GEMINI_API_KEY
Cohere command, command-light COHERE_API_KEY
Ollama llama2, codellama, mistral, etc. None (local)

Security

AgentOS is designed with security as a first-class concern.

Command Filtering

Dangerous commands are blocked by default:

File Deletion

rm, rmdir, del

System Modification

sudo, chown, chmod

Disk Operations

dd, mkfs, fdisk, format

Process Control

kill, killall, pkill

Input Validation

The following are sanitized to prevent command injection:

  • Shell metacharacters: ; && || |
  • Command substitution: ` $()
  • Variable expansion: $VAR

Resource Limits

Limit Default Configurable
Command timeout 30 seconds Yes
Steps per task 10 steps Yes
LLM retry attempts 3 attempts Yes

agentos run

Run an agent with a specified task.

Usage

agentos run <manifest> --task "<task>" [options]

Options

Option Description Default
--task Task description for the agent Required
--timeout Maximum execution time in seconds 300
--verbose Enable verbose output false

Examples

# Basic usage
agentos run agent.yaml --task "create a REST API"

# With timeout
agentos run agent.yaml --task "analyze data" --timeout 600

# Verbose mode
agentos run agent.yaml --task "debug code" --verbose

agentos chat

Start an interactive chat session with an LLM.

Usage

agentos chat [options]

Options

Option Description Default
--provider LLM provider to use openai
--model Specific model Provider default
--temperature Response creativity (0-1) 0.7
--system-prompt Custom system prompt Default prompt

In-Chat Commands

Command Action
exit / quit End the chat session
clear Clear chat history
help Show available commands
status Show session info

Examples

# Default chat
agentos chat

# Use Claude
agentos chat --provider claude

# Local Ollama (no API key needed)
agentos chat --provider ollama

# Custom settings
agentos chat --provider openai --model gpt-4 --temperature 0.3

agentos ps

List all agents and their status.

Usage

agentos ps

Output Example

NAME              STATUS      STARTED              TASK
my_assistant      running     2026-01-16 10:30:00  create a Python script
research_agent    completed   2026-01-16 09:15:00  analyze market data
code_helper       failed      2026-01-16 08:00:00  debug application

agentos logs

View logs for a specific agent.

Usage

agentos logs <agent_name> [options]

Options

Option Description Default
--tail Number of lines to show All
--follow Follow log output false

agentos stop

Stop a running agent.

Usage

agentos stop <agent_name>

Docker Isolation

Enable Docker sandboxing for maximum security.

Requirements

  • Docker daemon must be running
  • User must have Docker permissions

Enable Isolation

Set isolated: true in your agent manifest:

name: secure_agent
model_provider: github
model_version: openai/gpt-4o-mini
isolated: true

API Reference

For programmatic access, see the Python API documentation.

View API Docs

Troubleshooting

Agent won't start

Check that your API key is set correctly in the .env file and the manifest is valid YAML.

Connection timeout

Verify your internet connection and check if the LLM provider's API is available.

Docker isolation fails

Ensure Docker is running with docker ps and your user has permissions.

Command blocked unexpectedly

Review your DESTRUCTIVE_COMMANDS list in the manifest.