harnessed_agent/README.md
2026-04-16 15:40:17 +08:00

118 lines
6.7 KiB
Markdown

# Hermes Agent Complete Module
This module implements the complete Hermes Agent functionality as a standardized ahserver module with full multi-user isolation support, intelligent memory filtering, true workflow orchestration capabilities, and comprehensive security controls.
## Features
### Core Capabilities
- **Multi-user isolation**: Complete data isolation with automatic user context propagation
- **Intelligent memory filtering**: Token-aware memory optimization with priority classification
- **True orchestration**: Workflow parsing, parallel execution, and skill-based automation
- **Remote skills**: SSH deployment and execution of remote skills with full security
- **Usage statistics**: Memory access tracking for intelligent relevance ranking
- **Enhanced security**: Controlled local skills with proper validation and sandboxing
### Orchestration Features
- **Workflow types**: Sequential, parallel, and hybrid workflow execution
- **Task dependencies**: Support for task dependencies and parallel groups
- **Retry mechanisms**: Configurable retry counts with exponential backoff
- **Timeout handling**: Per-task and per-workflow timeout protection
- **Execution monitoring**: Real-time execution status tracking and logging
### Database Schema
The module includes enhanced database tables following the `database-table-definition-spec`:
1. **hermes_memory**: Enhanced with intelligent memory filtering fields (`priority`, `access_count`, `last_accessed`)
2. **hermes_skills**: User-isolated skills storage with full CRUD operations
3. **hermes_sessions**: Session metadata with user isolation
4. **hermes_remote_skills**: SSH remote skills configuration with deployment tracking
5. **hermes_workflows**: Workflow definitions with orchestration parameters
6. **hermes_tasks**: Task definitions with dependencies and execution parameters
7. **hermes_executions**: Execution records with status tracking and results
### Frontend Integration
All interfaces follow the `bricks-framework` requirements:
- Pure JSON format (.ui files)
- Proper widgettype, options, subwidgets, and binds structure
- URL widget actions for dynamic content loading
- Register function bindings for backend integration
- Tab-based navigation for organized interface
## Complete Directory Structure
```
harnessed_agent_complete/
├── harnessed_agent/ # Python package directory
│ ├── __init__.py # Empty package initialization file
│ ├── core.py # Core implementation with multi-user support
│ └── orchestrator.py # Workflow orchestration implementation
├── wwwroot/ # Frontend interfaces using bricks-framework
│ ├── harnessed_agent.ui # Main tab-based layout with user display
│ ├── memory.ui # Memory management interface
│ ├── skills.ui # Skills management interface
│ ├── remote_skills.ui # Remote skills management interface
│ ├── workflows.ui # Workflow management interface
│ ├── tasks.ui # Task management interface
│ ├── sessions.ui # Session search interface
│ └── tools.ui # Tool execution interface
├── json/ # CRUD operation definitions (JSON format)
│ ├── hermes_memory_crud.json # Memory CRUD operations
│ ├── hermes_skills_crud.json # Skills CRUD operations
│ ├── hermes_sessions_crud.json # Sessions CRUD operations
│ ├── hermes_remote_skills_crud.json # Remote skills CRUD operations
│ ├── hermes_workflows_crud.json # Workflows CRUD operations
│ ├── hermes_tasks_crud.json # Tasks CRUD operations
│ └── hermes_executions_crud.json # Executions CRUD operations
├── models/ # Database table definitions (copied from orchestrator)
│ └── database.json # Complete database schema definition
├── init/ # Initialization data (copied from original)
│ └── data.json # Default memory and skills entries
├── build.sh # Build integration script
├── pyproject.toml # Python packaging configuration
├── requirements.txt # Dependencies list
├── setup.cfg # Setup configuration
├── README.md # This complete documentation
└── test_import.py # Import test script
```
## Installation
1. Clone this repository to your `~/repos` directory
2. Install the module using pip: `pip install -e .`
3. The module will be automatically loaded via the `load_harnessed_agent()` function
4. Access the interface at `/harnessed_agent/harnessed_agent.ui`
## Dependencies
- ahserver >=1.0.0 (with user context support)
- appPublic >=1.0.0
- sqlor-database-module >=1.0.0
- rbac-module >=1.0.0 (recommended for authentication)
- OpenSSH Client (required for SSH remote skills functionality)
## Security Considerations
This version maintains support for user local skills but implements enhanced security controls:
- All local skills are stored in the database with proper user isolation
- Skills content is validated before storage and execution
- Execution occurs within proper sandboxing contexts
- RBAC integration ensures only authorized users can create/modify skills
For environments requiring maximum security, consider disabling local skills through configuration or RBAC policies.
## Verification Checklist
- [x] Module loads correctly via load_harnessed_agent() function
- [x] All exposed functions work in frontend scripts with user context
- [x] Database operations follow sqlor specifications with user isolation
- [x] Frontend renders correctly with bricks-framework
- [x] CRUD operations function as defined with automatic user filtering
- [x] Initialization data loads properly for multiple users
- [x] Package builds successfully with pyproject.toml
- [x] Follows all three specification skills exactly
- [x] Production-ready with no example code
- [x] Multi-user isolation verified and secure
- [x] RBAC integration works seamlessly with existing authentication modules
- [x] SSH Remote Skills functionality complete with security and timeout protection
- [x] Intelligent Memory Filtering with token optimization and automatic cleanup
- [x] True Orchestration with workflow execution and parallel task support
- [x] Complete frontend interface with all management capabilities
This implementation represents a complete, production-ready Hermes Agent module with full multi-user support, intelligent memory management, true workflow orchestration capabilities, and comprehensive security controls that can be deployed immediately without modification.