Cleo
Repository
  • Getting Started
    • System Requirements & Dependencies
    • Project Structure & Key Components
  • Agent Creation
  • Memory & Storage
  • Running Cleo
    • Server & Container Environments
    • Local Deployment
    • Scheduled & Background Execution
  • Integration with External APIs
  • Data Storage and Management
  • Task Scheduling and Execution
  • Logging and Monitoring
  • Advanced Agent Configuration and Customization
Powered by GitBook
On this page
  • Prerequisites
  • Server Setup
  • Containerized Deployment (Docker)
  • Running in Cloud Environments
  • Persistent Agent Loops
  • Configuring for High Availability
  • Summary
  1. Running Cleo

Server & Container Environments

Deploying Cleo in a server or containerized environment is an ideal choice for scaling, long-running tasks, or production-level use cases. This guide walks through setting up Cleo on a server, whether on a dedicated machine, a virtual private server (VPS), or within a Docker container.


Prerequisites

Before deploying Cleo in a server or containerized environment, ensure the following:

  • Linux-based environment (Ubuntu, CentOS, or any UNIX-based system)

  • SSH access to the server (or cloud instance)

  • A working Python 3.10+ installation (may use virtualenv)

  • A Docker environment (if opting for containerization)

Optional but recommended:

  • Supervisor for process management

  • Nginx or Traefik for reverse proxy and load balancing

  • SSL certificates for securing agent APIs


Server Setup

1. SSH Access

If you're deploying to a remote server, ensure you have SSH access:

bashCopyEditssh user@your-server-ip

2. Clone Cleo on the Server

Just like local deployment:

bashCopyEditgit clone https://github.com/HUADA999/Cleo.git
cd Cleo

3. Create Virtual Environment

For a clean setup:

bashCopyEditpython3 -m venv cleo_env
source cleo_env/bin/activate

Or use a pre-configured tool like Poetry for dependency management:

bashCopyEditpoetry install
poetry shell

4. Install Dependencies

Install required Python libraries:

bashCopyEditpip install -r requirements.txt

Ensure all necessary dependencies, such as PyTorch or FAISS, are installed as needed for your server configuration.


Containerized Deployment (Docker)

Running Cleo in Docker offers an isolated, portable, and reproducible environment that can be easily deployed across multiple systems. This method also simplifies scaling Cleo to handle more agents or concurrent tasks.

1. Create a Dockerfile

To containerize Cleo, create a Dockerfile in the root of the project:

dockerfileCopyEditFROM python:3.10-slim

WORKDIR /app

COPY . /app

RUN pip install --upgrade pip
RUN pip install -r requirements.txt

CMD ["python", "main.py"]

2. Build the Docker Image

Run the following command to build the image:

bashCopyEditdocker build -t cleo-agent .

3. Run the Container

To run Cleo in a container:

bashCopyEditdocker run -d --name cleo-agent cleo-agent

This will start the agent in the background. Use the following to check logs:

bashCopyEditdocker logs cleo-agent

Running in Cloud Environments

If you're deploying Cleo to a cloud provider (AWS, Azure, GCP), you’ll typically set up a virtual machine (VM) or a container service (like Kubernetes). Here's how to do it:

1. AWS EC2 Example

  • Launch an EC2 instance with Ubuntu (or any Linux distro).

  • SSH into the instance:

    bashCopyEditssh -i "your-key.pem" ubuntu@your-ec2-public-ip
  • Follow the server setup instructions above to install Python, clone the repository, and configure the environment.

2. Kubernetes Example

You can deploy Cleo on Kubernetes to manage multiple agents across a cluster. This involves:

  1. Creating a Deployment YAML file for Cleo.

  2. Creating a Service to expose Cleo externally or internally.

  3. Managing scaling via Horizontal Pod Autoscaling if you need to deploy multiple agent instances.


Persistent Agent Loops

In production systems, you likely want Cleo to run as a persistent background service. You can manage this using systemd or supervisor.

Using Supervisor

  1. Install supervisor on the server:

bashCopyEditsudo apt install supervisor
  1. Create a cleo-agent.conf file under /etc/supervisor/conf.d/:

iniCopyEdit[program:cleo-agent]
command=python /path/to/Cleo/main.py
autostart=true
autorestart=true
stderr_logfile=/var/log/cleo-agent.err.log
stdout_logfile=/var/log/cleo-agent.out.log
  1. Update supervisor:

bashCopyEditsudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start cleo-agent

Configuring for High Availability

For high availability (HA), consider the following:

  1. Load Balancing: Use Nginx or Traefik as a reverse proxy to distribute incoming requests among multiple Cleo agent instances.

  2. Multiple Instances: Deploy multiple Cleo instances across different machines or containers to manage load.

  3. Database Storage: Consider integrating a more robust database backend like PostgreSQL or MongoDB to handle large-scale memory storage for multiple agents.


Summary

Server and container-based deployments offer scalability, persistence, and production readiness for Cleo. Once set up on your infrastructure, you can manage agent workloads, control updates, and scale your agents based on task complexity.

PreviousRunning CleoNextLocal Deployment

Last updated 1 month ago