Remote Deployment via SSH
Relevant source files
The following files were used as context for generating this wiki page:
Remote Deployment via SSH in the WIREDUP project is a core capability managed by the SSHManager. This system enables AI agents and developers to securely interact with remote infrastructure by executing commands, managing file transfers, and orchestrating deployment workflows. It is designed to be production-ready, supporting secure key management, connection pooling, and multi-agent coordination.
The system integrates directly with the project's Auto-Wiring Engine to provide agents with seamless access to remote execution capabilities. By utilizing standardized protocols and secure credential handling, the SSH module ensures that remote operations are both efficient and protected.
Sources: README.md:12, src/ssh/manager.py:1-50, AGENT.md:15-20
SSH Management Architecture
The SSH architecture is built around the SSHManager class and the SSHCredentials data structure. The manager handles the lifecycle of remote connections, including establishment, command execution, and cleanup.
Core Components
| Component | Description |
|---|---|
SSHManager | Primary controller for managing remote connections and executing commands. |
SSHCredentials | Data structure containing host, port, username, password, or key file details. |
SSHCommandSkill | An agent-facing skill that wraps the manager for use in AI workflows. |
RemoteAgent | A specialized agent type designed for deployment on remote servers. |
Sources: src/ssh/manager.py (inferred from SSHManager implementation), examples/ssh_deployment.py:24-34, SKILLS.md:88-100, AGENT.md:275-295
Connection Flow
The following diagram illustrates the sequence of operations when executing a remote command via the SSH module.
This flow ensures that every interaction is encapsulated within a managed connection state, providing clear success or failure feedback through the SSHResult structure.
Sources: src/ssh/manager.py:10-40, examples/ssh_deployment.py:38-48
Command Execution and Batching
The system supports both single command execution and batch processing. Batch processing is particularly useful for deployment scripts where multiple sequential steps (e.g., pwd, git pull, make) are required.
Execution Methods
execute(command, credentials): Establishes a connection, runs a single string command, and returns the output.execute_batch(commands, credentials): Takes a list of strings and executes them sequentially over a managed connection.ssh_exec(CLI): A command-line interface implementation allowing users to trigger remote commands directly from the terminal.
Sources: src/ssh/manager.py:20-50, examples/ssh_deployment.py:53-65, src/cli.py:204-232
# Batch execution example from source
commands = [
'pwd',
'whoami',
'date',
'uname -a'
]
results = manager.execute_batch(commands, credentials=credentials)
Sources: examples/ssh_deployment.py:53-61
Remote Agent Deployment
Advanced deployment is handled by the RemoteAgent, which utilizes the SSHManager to bootstrap itself onto a remote server. This process involves uploading the agent's source code and initiating its execution environment.
Deployment Workflow
- Code Upload: The agent uses
upload_fileto transfer the implementation script to the target/opt/agents/directory. - Environment Setup: Commands are executed to ensure Python and dependencies are available.
- Start Agent: A final command triggers the remote agent process.
Configuration and Security
Remote deployment settings are managed through the global configuration system, allowing for secure defaults and environment-specific overrides.
SSH Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
ssh.enabled | Boolean | false | Global toggle for SSH capabilities. |
ssh.default_timeout | Integer | 30 | Timeout in seconds for connection attempts. |
ssh.max_connections | Integer | 10 | Limit for the connection pool. |
ssh.connection_pool.max_age | Integer | 3600 | Maximum age of a pooled connection in seconds. |
Sources: config/default.json:20-30, src/cli.py:52-55
Security Best Practices
- Key Rotation: The system supports
SSH_KEY_PATHconfiguration for using ED25519 or RSA keys instead of passwords. - Credential Masking: Sensitive data is intended to be handled via environment variables like
AI_SSH_KEY_PATH. - Sandboxing: Remote execution should be restricted to
allowed_commandswhen using theExecutionAgentsubtype to prevent arbitrary system access.
Sources: README.md:15, AGENT.md:150-160, config/default.json:44-50
Summary
Remote Deployment via SSH provides the foundational infrastructure for WIREDUP's distributed agent capabilities. By combining a robust SSHManager with specialized agent types and skills, the project enables automated, secure, and scalable remote environment management. Whether triggered via the CLI, an automated script, or an AI agent, the SSH module ensures consistent execution and detailed reporting through its structured result types and connection management.
Sources: src/ssh/manager.py:1-100, AGENT.md:275-300, README.md:40-50