Metadata-Version: 2.4
Name: darrxscale-workspace-agent
Version: 1.2.0
Summary: DarrxScale Workspace Agent — remote tool execution engine for the DarrxScale Agentic System
Author-email: DarrxScale <hello@darrxscale.com>
License: MIT
Project-URL: Homepage, https://github.com/sajid-the-backend-engineer/darrxscale-workspace-agent
Project-URL: Documentation, https://github.com/sajid-the-backend-engineer/darrxscale-workspace-agent#readme
Project-URL: Repository, https://github.com/sajid-the-backend-engineer/darrxscale-workspace-agent
Project-URL: Issues, https://github.com/sajid-the-backend-engineer/darrxscale-workspace-agent/issues
Keywords: agent,workspace,automation,tools,remote-execution,signals,redis
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Systems Administration
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: websockets>=12.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: cryptography>=41.0
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: redis>=5.0
Provides-Extra: browser
Requires-Dist: playwright>=1.40; extra == "browser"
Provides-Extra: android
Requires-Dist: uiautomator2>=3.0; extra == "android"
Provides-Extra: all
Requires-Dist: playwright>=1.40; extra == "all"
Requires-Dist: uiautomator2>=3.0; extra == "all"

# DarrxScale Workspace Agent

[![PyPI](https://img.shields.io/pypi/v/darrxscale-workspace-agent)](https://pypi.org/project/darrxscale-workspace-agent/)
[![Python](https://img.shields.io/pypi/pyversions/darrxscale-workspace-agent)](https://pypi.org/project/darrxscale-workspace-agent/)

A standalone tool execution engine that runs on your machine. Receives tool commands from the DarrxScale backend via WebSocket, executes them locally, and returns results.

## Install

```bash
pip install darrxscale-workspace-agent
```

## Quick Start

```bash
# Get your token from the DarrxScale Workspace Hub
workspace-agent --server wss://your-server.com --token dt_ws_your_token --workspace ~/projects
```

Or with Python module:

```bash
python -m agent_runtime --server wss://your-server.com --token dt_ws_your_token --workspace ~/projects
```

## Docker

```bash
docker run -d \
  --name workspace-agent \
  -v ~/projects:/workspace \
  -e TOKEN=dt_ws_your_token \
  -e SERVER=wss://your-server.com \
  darrxscale/workspace-agent:latest
```

## What It Does

- **Executes tools locally**: filesystem, shell, browser, Android, web fetch, email
- **Service API calls**: receives credential-less specs from backend, resolves credentials from local encrypted vault
- **Credentials stay local**: entered in the frontend, synced to your machine, never stored on servers
- **Multi-agent**: one instance serves all your agents — configure routing from the frontend

## Architecture

```
Frontend (control plane)
    ↓ WSS
Backend (LLM + orchestration)
    ↓ WSS
Workspace Agent (your machine)
    → Local tools (file, shell, browser)
    → Service executor (vault → inject creds → HTTP)
    → Encrypted credential vault
```

## Configuration

| Env Var | Default | Description |
|---------|---------|-------------|
| `TOKEN` | (required) | Auth token from the frontend |
| `SERVER` | `wss://localhost:8000` | Backend WSS URL |
| `WORKSPACE_PATH` | `/workspace` | Working directory |
| `LOG_LEVEL` | `INFO` | Logging level |
| `AUDIT_LEVEL` | `full` | Audit detail: `full`, `summary`, `errors_only` |

## Optional Extras

```bash
# Browser automation (Playwright)
pip install darrxscale-workspace-agent[browser]

# Android automation
pip install darrxscale-workspace-agent[android]

# Everything
pip install darrxscale-workspace-agent[all]
```

## Long-running commands

`RUN_COMMAND` waits for a command to finish, at most 300 seconds. A command that keeps running (a dev server, a
watcher, a long install) is started with `background: true`: the call returns at once with the process id and the
log file its output goes to (`<workspace>/.aadml-background/`). Read that file to see the output, and stop the
process with `Stop-Process -Id <pid>` (Windows) or `kill <pid>`.

On Windows, commands run in PowerShell 7 (`pwsh`) when it is installed, else in Windows PowerShell. With Windows
PowerShell, `a && b` runs as `a; if ($?) { b }` and `source venv/bin/activate` as `. venv\Scripts\Activate.ps1`;
`||` needs PowerShell 7.

## Connection and reconnects

- The agent keeps answering the server while a command runs, so a long command does not make the PC look
  disconnected.
- If the connection drops while a command runs, the command finishes and its result is kept. It is sent as soon as
  the agent reconnects (results older than 10 minutes are dropped: nothing waits for them any more).
- After a server restart or deploy (close codes 1001, 1006, 1012, 1013, or the server refusing connections) the
  agent reconnects within about 1 to 5 seconds. Other drops back off exponentially, 1 s doubling to at most 300 s.
  Every delay has ±20% jitter.
- On connect the agent reports its version, operating system and workspace folder.

## Self Test

```bash
workspace-agent --self-test
```

## Security

- **Encrypted vault**: credentials stored with AES-256-GCM, key derived from your token
- **Per-agent limits**: filesystem restrictions, command allowlists, rate limits
- **Audit trail**: every tool execution logged as structured JSON to stdout
