Metadata-Version: 2.4
Name: pyexec-worker
Version: 0.1.0
Summary: Local execution agent for PyExecutor — run workflow steps on-premises
Author-email: PyExec <hello@pyexecutor.com>
License: MIT
Project-URL: Homepage, https://pyexecutor.com
Project-URL: Documentation, https://docs.pyexecutor.com
Project-URL: Repository, https://github.com/pyexecutor/worker
Project-URL: Bug Tracker, https://github.com/pyexecutor/worker/issues
Keywords: pyexec,worker,agent,workflow,on-premises,local,automation
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Distributed Computing
Classifier: Topic :: System :: Systems Administration
Classifier: Environment :: Console
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: click>=8.0
Requires-Dist: httpx>=0.24
Requires-Dist: websockets>=11.0
Requires-Dist: cryptography>=41.0
Requires-Dist: psutil>=5.9
Requires-Dist: requests>=2.28

# pyexec-worker

Local execution agent for [PyExecutor](https://github.com/your-org/pyexec).

Allows workflow steps to run on-premises instead of (or alongside) the cloud worker.

## Quick start

```bash
pip install pyexec-worker

# Generate keys + register with your PyExecutor server
pyexec-worker register \
  --server https://your-pyexec-server.example.com \
  --org-token <token-from-settings> \
  --name "Office Server"

# Start the agent
pyexec-worker start
```

## Installation

```bash
pip install pyexec-worker
```

## Requirements

- Python 3.9+
- Docker (for script step execution)
- Network access to your PyExecutor server

## Configuration

Settings are stored in `~/.pyexec-worker/config.json`.
The agent token is stored separately in `~/.pyexec-worker/agent.token` (chmod 600).

| Environment variable     | Description                              | Default                   |
|--------------------------|------------------------------------------|---------------------------|
| `PYEXEC_SERVER_URL`      | PyExecutor server URL                    | `http://localhost:8000`   |
| `PYEXEC_AGENT_TOKEN`     | Agent bearer token (overrides file)      | —                         |
| `PYEXEC_AGENT_NAME`      | Display name for this agent              | hostname                  |
| `PYEXEC_POLL_INTERVAL`   | HTTP poll interval (seconds)             | `5`                       |
| `PYEXEC_HEARTBEAT_INTERVAL` | Heartbeat interval (seconds)          | `30`                      |
| `PYEXEC_MAX_CONCURRENT`  | Maximum concurrent steps                 | `4`                       |
| `PYEXEC_DOCKER_IMAGE`    | Default Docker image for script steps    | `python:3.11-slim`        |
| `PYEXEC_USE_WEBSOCKET`   | Use WebSocket transport (`true`/`false`) | `true`                    |

## Security

- RSA-2048 key pair generated on first `register` — private key never leaves your machine.
- Org secrets are encrypted server-side under your agent's public key before delivery.
- The agent token is stored at `~/.pyexec-worker/agent.token` with mode 600.

## Commands

```
pyexec-worker register  --server URL --org-token TOKEN [--name NAME]
pyexec-worker start     [--server URL]
pyexec-worker status
```
