agentsociety.executor.process

Process-based task executor.

This module provides a process-based implementation of task execution, similar to the Kubernetes executor but using local processes instead.

Module Contents

Classes

Data

API

agentsociety.executor.process.__all__

[‘ProcessExecutor’]

class agentsociety.executor.process.ProcessExecutor(home_dir: str)

Initialization

Initialize the process executor.

Args: home_dir (str): Base directory for storing process data and logs

_get_status_file(exp_id: str, tenant_id: str) pathlib.Path

Get the path to the status file for a given experiment.

Args: exp_id (str): Experiment ID tenant_id (str): Tenant ID

Returns: Path: Path to the status file

_get_log_file(exp_id: str, tenant_id: str) pathlib.Path

Get the path to the log file for a given experiment.

Args: exp_id (str): Experiment ID tenant_id (str): Tenant ID

Returns: Path: Path to the log file

_acquire_file_lock(file_path: pathlib.Path)

Acquire an exclusive lock on a file.

Args: file_path (Path): Path to the file to lock

_release_file_lock(lock_fd: int)

Release a file lock.

Args: lock_fd (int): File descriptor of the lock

async create(config_base64: Optional[str] = None, config_path: Optional[str] = None, callback_url: str = '', callback_auth_token: str = '', tenant_id: str = '')

Create a new process for task execution.

Args: config_base64 (Optional[str]): Base64 encoded configuration config_path (Optional[str]): Path to configuration file callback_url (str): URL to call when task completes callback_auth_token (str): Authentication token for callback tenant_id (str): Tenant ID

async delete(tenant_id: str, exp_id: str) None

Delete a running process.

Args: tenant_id (str): Tenant ID exp_id (str): Experiment ID

Raises: Exception: If process not found or deletion fails

async get_logs(tenant_id: str, exp_id: str, line_limit: int = 1000) str

Get logs for a process.

Args: tenant_id (str): Tenant ID exp_id (str): Experiment ID line_limit (int): Number of lines to return

Returns: str: Process logs

Raises: Exception: If logs not found

async get_status(tenant_id: str, exp_id: str) str

Get status of a process.

Args: tenant_id (str): Tenant ID exp_id (str): Experiment ID

Returns: str: Process status

Raises: Exception: If status not found