Ward - The Universal Safety Layer for AI Agents. Cross-platform sandbox protection for any AI agent.
Project description
Ward - The Universal Safety Layer for AI Agents
Your AI's safety net โ Universal sandbox protection for any AI agent on any platform.
๐ Quick Start
Installation
pip install ward-ai
Universal AI Agent Protection
Ward works as a CLI wrapper around any AI agent command:
# Protect Claude Desktop
ward run "claude code 'Fix the login bug'"
# Protect Ollama
ward run "ollama run codellama 'Refactor this function'"
# Protect any Python AI agent
ward run "python my_agent.py --task 'Add tests'"
# Protect shell commands
ward run "npm run build"
Quick Commands
# Start a protected session
ward start "Fix payment processing bug"
# Check what's happening
ward status
# Approve changes (promote to main codebase)
ward approve
# Emergency stop
ward kill
The Problem
AI agents are powerful but dangerous:
- No isolation โ AI writes directly to your files
- Platform limitations โ Anthropic's sandbox only works on Mac/Linux
- No universal protection โ Each AI tool has different safety mechanisms
- Windows gap โ 60% of developers use Windows but lack AI sandbox protection
The Solution
Ward is the universal safety layer that works with ANY AI agent on ANY platform:
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ
โ Any AI โโโโโโถโ Ward Wrapper โโโโโโถโ Container โโโโโโถโ Validation โ
โ Agent โ โ (CLI Layer) โ โ Sandbox โ โ Gate โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ โ
โ Main Codebase โโโโโโโ Promote โโโโโโโโโโโโโโ
โ (Protected) โ โ (if safe) โ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
๐ฏ Key Differentiators
vs. Native Solutions: Works on Windows (Docker/venv fallback)
vs. Vibe Kanban: We focus on Security, they focus on Speed
vs. Ralph: Ralph manages workflows, Ward provides safety brakes
โจ Features
๐ก๏ธ Universal Protection
- Any AI Agent: Claude, Ollama, OpenAI, custom Python agents
- Any Platform: Windows (Docker/venv), macOS (native), Linux (native)
- Any Command: Wrap shell commands, scripts, or AI tools
- Container Isolation: Docker-first with intelligent fallbacks
๏ฟฝ AWindows-First Design
- Docker Desktop Integration: Seamless Windows container support
- Fallback Modes: Python venv + tempfile when Docker unavailable
- Path Handling: Robust Windows path resolution and security
- Performance Optimized: Fast file sync and minimal overhead
๐ค AI Integration
- CLI Wrapper:
ward run "any command here" - Session Management: Track and control AI work sessions
- Real-time Monitoring: See what AI is doing in real-time
- Emergency Controls:
ward killfor immediate shutdown
๏ฟฝ Enterprise Ready
- Audit Logging: Complete trail of all AI actions
- Validation Pipeline: Syntax, tests, security, scope checks
- Modular Architecture: Plugin system for custom validators
- Open Core Model: Free core + enterprise plugins
๐ Usage Examples
Universal Command Wrapping
# Protect any AI agent
ward run "claude code 'Fix the authentication system'"
ward run "ollama run codellama 'Add comprehensive tests'"
ward run "python my_agent.py --task 'Refactor for performance'"
# Protect development commands
ward run "npm run build"
ward run "python manage.py migrate"
ward run "cargo build --release"
# Stream output in real-time
ward run --stream "pytest tests/ -v"
Session Management
# Start a protected session for AI work
ward start "Implement user authentication"
# Check what's happening
ward status
# Approve changes (promote to main codebase)
ward approve
# Emergency stop everything
ward kill --all
Platform-Specific Features
# Force Docker isolation (Windows/macOS/Linux)
ward run --isolation docker "python train_model.py"
# Use venv fallback (when Docker unavailable)
ward run --isolation venv "pip install -r requirements.txt"
# Auto-detect best method (default)
ward run "make test"
๐ง Configuration
Basic Configuration
from ward import SandboxConfig, AutonomyLevel, ValidationMode
config = SandboxConfig(
main_codebase="/path/to/your/project",
autonomy_level=AutonomyLevel.VALIDATED, # supervised, validated, autonomous
validation_mode=ValidationMode.STRICT, # strict, permissive, audit_only
max_files_per_session=50,
max_lines_changed=2000,
session_timeout_minutes=120
)
Windows-Specific Setup
# Install Docker Desktop (recommended)
# Download from: https://www.docker.com/products/docker-desktop
# Verify Docker is running
docker --version
# Install Ward
pip install ward-ai
# Test Ward with Docker
ward run "echo 'Hello from Ward on Windows!'"
Enterprise Configuration
# Enterprise features (coming soon)
config = SandboxConfig(
# ... basic config ...
audit_logging=True,
remote_execution=True,
team_permissions=True,
compliance_mode="SOC2"
)
๐๏ธ Architecture
Universal Wrapper Design
โโโโโโโโโโโโโโโโโโโ
โ ward run โ โ CLI Command
โ "any command" โ
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Universal โ โ Command Parser & Router
โ Wrapper โ
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโผโโโโโโ
โ Platform โ โ Windows/macOS/Linux Detection
โ Detection โ
โโโโโโโฌโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Isolation โ โ Docker โ venv โ native
โ Method โ
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Sandbox โ โ Container/venv/directory
โ Environment โ
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Command โ โ Execute with monitoring
โ Execution โ
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Validation โ โ Syntax, tests, security
โ Pipeline โ
โโโโโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโ
โ Approval โ โ Manual or auto-promote
โ Gate โ
โโโโโโโโโโโโโโโโโโโ
Windows Integration
Ward provides first-class Windows support through:
- Docker Desktop Integration: Seamless Windows container support
- Intelligent Fallbacks: Python venv when Docker unavailable
- Path Handling: Robust Windows path resolution and security
- Performance: Optimized file sync and minimal overhead
๐ Advanced Usage
Custom Validators
from ward.validators import BaseValidator, ValidationResult
class MyCustomValidator(BaseValidator):
async def validate(self, changes: list[FileChange]) -> ValidationResult:
# Your custom validation logic
return ValidationResult(
passed=True,
message="Custom validation passed",
details={}
)
# Register validator
ward.add_validator(MyCustomValidator())
Programmatic Usage
import asyncio
from ward import get_wrapper, SandboxConfig
async def main():
config = SandboxConfig(main_codebase="./my-project")
wrapper = await get_wrapper(config)
# Execute command safely
result = await wrapper.wrap_command("python train.py")
if result.validation_passed:
await wrapper.approve_session(result.session_id)
else:
print("Validation failed:", result.validation_results)
asyncio.run(main())
CI/CD Integration
# GitHub Actions example
- name: Run tests with Ward protection
run: |
pip install ward-ai
ward run "pytest tests/ --cov=src/"
ward approve # Auto-approve if tests pass
๐ Security Features
Isolation Levels
- Container Isolation: Full OS-level isolation via Docker
- Process Isolation: Python venv with restricted filesystem access
- Network Isolation: No network access by default in containers
- Resource Limits: CPU, memory, and disk usage constraints
Validation Pipeline
- Syntax Validation: AST parsing for code correctness
- Test Validation: Automated test execution
- Security Scanning: Detect secrets, vulnerabilities
- Scope Validation: Ensure changes within allowed paths
- Custom Rules: Project-specific validation logic
Audit Trail
# View complete audit log
ward report --output audit.json
# Session-specific logs
ward status --session abc123 --verbose
๐ง Development
Installation from Source
git clone https://github.com/nashihamm/ward.git
cd ward
pip install -e .
Running Tests
pytest tests/ -v --cov=ward
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
๐ Requirements
- Python 3.10+
- Docker Desktop (recommended for Windows)
- Git (for worktree sandbox mode)
Platform Support
| Platform | Docker | Venv Fallback | Status |
|---|---|---|---|
| Windows 10/11 | โ Docker Desktop | โ Python venv | Full Support |
| macOS | โ Docker Desktop | โ Python venv | Full Support |
| Linux | โ Docker Engine | โ Python venv | Full Support |
๐ค Contributing
Ward is open source and welcomes contributions! We're especially interested in:
- Windows-specific improvements and testing
- Additional AI agent integrations
- Custom validator implementations
- Performance optimizations
- Documentation improvements
๏ฟฝ Liccense
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Docker for containerization technology
- Model Context Protocol (MCP) for AI tool integration
- Claude and Ollama for inspiring AI agent safety
- The open source community for amazing Python libraries
๐ Support & Community
- ๐ง Email: nashihamm@outlook.com
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ Documentation: Ward Docs
๐ Roadmap
Phase 1: Universal Core (Current)
- โ CLI wrapper for any command
- โ Windows Docker Desktop integration
- โ Venv fallback isolation
- โ Basic validation pipeline
Phase 2: AI Agent Integration
- ๐ Enhanced Claude Desktop integration
- ๐ Native Ollama support
- ๐ OpenAI API integration
- ๐ Custom agent templates
Phase 3: Enterprise Features
- ๐ Team management and permissions
- ๐ Centralized audit logging
- ๐ Remote cloud execution
- ๐ Compliance frameworks (SOC2, GDPR)
Phase 4: Ecosystem
- ๐ VS Code extension
- ๐ Plugin marketplace
- ๐ Community validators
- ๐ Integration templates
Ward - Because every AI agent needs a safety net. ๐ก๏ธ
Made with โค๏ธ for safer AI development on every platform
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ward_ai-0.1.0.tar.gz.
File metadata
- Download URL: ward_ai-0.1.0.tar.gz
- Upload date:
- Size: 59.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c388eabfa57d1f570f170c2a27a86b7893ddf79251cc53f70f132106cc1a8ae3
|
|
| MD5 |
f39074420873ab8136167faadabdf229
|
|
| BLAKE2b-256 |
df2e8a204f1bd204abdcafb712155364512d4d2630a76de114bf8604edc07bcf
|
File details
Details for the file ward_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ward_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 61.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ca5522bed2bddd77d3113c8055b360cc7ee79cdb6967693602e5185acc0dc05
|
|
| MD5 |
ed3bc82e2772a5cf86372e2d997c658b
|
|
| BLAKE2b-256 |
7d4f1e77a2a5c31d9c3548194aab9e313f2a0c0eb1b8d07603534061516e2788
|