AI Agentic Workflows Module
Government-compliant agentic workflow system with FedRAMP/FISMA security controls, NIST 800-53 implementation, and OWASP-compliant API endpoints.
Overview
The AI Agentic Workflows module provides enterprise-grade AI-powered workflow orchestration for Drupal, enabling complex multi-step workflows with visual builders, ECA integration, and government-level security compliance.
Module Information
- Name: AI Agentic Workflows
- Machine Name:
ai_agentic_workflows - Package: AI Platform
- Version: 1.0.0
- Drupal Compatibility: ^10.3 || ^11
- OSSA Compliant: Yes
Source Location
/Users/flux423/Sites/LLM/all_drupal_custom/modules/ai_agentic_workflows/
Features
Core Capabilities
- Agentic Workflow Orchestration: Create and manage complex AI-powered workflows
- Multi-Provider AI Support: OpenAI, Anthropic, Ollama, and more
- Content Moderation: Automated content analysis with toxicity detection
- Visual Workflow Builder: Langflow integration for drag-and-drop design
- ECA Integration: Event-Condition-Action framework integration
- Queue Processing: Background execution of resource-intensive operations
- Scheduled Workflows: Cron-based workflow execution
- Real-time Monitoring: Dashboard with execution status and analytics
Security Features
- FedRAMP Ready: FedRAMP Moderate security controls
- NIST 800-53: Full implementation of NIST security controls
- FISMA Compliant: Federal Information Security Management Act compliance
- OWASP Top 10: Protection against common web vulnerabilities
- Rate Limiting: Configurable rate limits (default: 50/hour)
- Input Validation: XSS, SQL injection, and code injection protection
- Audit Logging: Complete audit trail of executions
- Encryption: Data encryption at rest and in transit
AI & Machine Learning
- Vector Embeddings: 768-dimensional vector storage for agent capabilities
- Pattern Learning: Automatic workflow optimization
- Performance Tracking: Historical performance data
- Model Versioning: Multiple ML model version management
- Agent Coordination: Multi-agent systems with task distribution
- Context Awareness: Context maintenance across workflow steps
Installation
Via Composer
composer require bluefly/ai_agentic_workflows:^1.0
drush en ai_agentic_workflows -y
drush updb -y
drush cr
Post-Installation
# Import configuration
drush config:import -y
# Initialize sample workflows
drush ai-workflow:install-samples
# Configure AI provider
drush cset ai.provider.openai.settings api_key "your-api-key" -y
Dependencies
Required Modules
- drupal:eck (^2.0)
- drupal:eca (^2.0)
- drupal:state_machine (^1.7)
- drupal:advancedqueue (^1.4)
- drupal:paragraphs (^1.17)
- drupal:entity_reference_revisions (^1.11)
- drupal:rules (^4.0)
- drupal:views_bulk_operations (^4.2)
- drupal:field_group (^3.4)
- drupal:inline_entity_form (^3.0)
- drupal:ai (^1.0)
- drupal:ai_agents (^1.0)
- drupal:ai_eca (^1.0)
- drupal:openapi_ui (^2.0)
- drupal:openapi_ui_redoc (^2.0)
Suggested Modules
- AI Ecosystem: ai_automators, ai_assistant_api, ai_logging, ai_search
- Workflow: maestro, workflow, workbench_moderation
- Performance: redis, memcache, monitoring, ultimate_cron
- Security: paranoia, seckit, security_review, tfa, encrypt, key
- UX: admin_toolbar, webform, entity_browser
Configuration
Basic Settings
Navigate to: /admin/config/workflow/agentic
# config/ai_agentic_workflows.settings.yml
workflow_engine: 'eca'
default_timeout: 300
max_workflow_steps: 20
enable_caching: true
cache_duration: 1800
Content Moderation
# config/ai_agentic_workflows.settings.yml
content_moderation:
enable_ai_moderation: true
sentiment_threshold: 0.3
toxicity_threshold: 0.8
quality_threshold: 0.6
auto_publish_threshold: 0.2
flag_threshold: 0.5
Security Configuration
# config/ai_agentic_workflows.security.yml
security:
rate_limiting:
enabled: true
max_executions_per_hour: 50
window: 3600
input_validation:
max_context_size: 524288
dangerous_patterns:
- 'javascript:'
- 'data:text/html'
- 'vbscript:'
audit_logging:
enabled: true
retention_days: 90
Usage
Creating a Workflow
Via UI
- Navigate to
/admin/config/workflow/agentic/flows/add - Configure:
- Label: Human-readable name
- Description: Purpose and functionality
- Event: Trigger event
- Action: AI action to perform
- Provider: AI provider
- Save workflow
Via Code
<?php
use Drupal\ai_agentic_workflows\Entity\AgenticFlow;
$flow = AgenticFlow::create([
'id' => 'custom_content_analyzer',
'label' => 'Custom Content Analyzer',
'description' => 'Analyzes content for quality and completeness',
'status' => TRUE,
'event' => 'content_save',
'action' => 'analyze_content',
'provider' => 'openai',
'workflow_steps' => [
[
'id' => 'analyze',
'label' => 'Analyze Content',
'agent_type' => 'content_analyzer',
'parameters' => [
'analysis_depth' => 'comprehensive',
'check_seo' => TRUE,
],
],
],
]);
$flow->save();
Via Drush
# Create from template
drush ai-workflow:create content_enhancement --template=content_processing
# List templates
drush ai-workflow:templates
# Custom workflow
drush ai-workflow:create my_workflow \
--label="My Custom Workflow" \
--event=content_save \
--action=analyze_content \
--provider=openai
Executing Workflows
Programmatically
<?php
// Load workflow
$flow = \Drupal::entityTypeManager()
->getStorage('agentic_flow')
->load('content_moderation');
// Execute
$executor = \Drupal::service('ai_agentic_workflows.flow_executor');
$result = $executor->executeFlow($flow, [
'node_id' => 123,
'prompt' => 'Analyze this content for quality',
]);
if ($result['success']) {
$analysis = $result['result'];
}
Via REST API
curl -X POST https://example.com/api/v1/agentic-workflows/execute \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{
"flow_id": "content_moderation",
"context": {
"node_id": 123
}
}'
Via Drush
# Execute workflow
drush ai-workflow:execute content_moderation --context='{"node_id": 123}'
# Execute all enabled
drush ai-workflow:execute-all
# List executions
drush ai-workflow:list-executions --flow=content_moderation
API Documentation
REST Endpoints
List Workflows
GET /api/v1/agentic-workflows
Execute Workflow
POST /api/v1/agentic-workflows/execute
Content-Type: application/json
{
"flow_id": "content_moderation",
"context": {
"node_id": 123
}
}
Response
{
"success": true,
"result": {
"toxicity_score": 0.1,
"sentiment": "positive",
"quality_score": 0.85
},
"execution_id": "abc123"
}
GraphQL API
query {
agenticWorkflows(status: ENABLED) {
id
label
description
executions(limit: 10) {
id
status
created
result
}
}
}
OpenAPI Documentation
- Swagger UI:
/admin/api/docs - ReDoc:
/admin/api/redoc
Hooks
hook_ai_agentic_workflows_flow_config_alter()
Modify flow configuration before creation.
<?php
function mymodule_ai_agentic_workflows_flow_config_alter(array &$config, string $flow_id) {
$config['context']['my_data'] = my_module_get_data();
}
hook_ai_agentic_workflows_flow_executed()
React to flow execution completion.
<?php
function mymodule_ai_agentic_workflows_flow_executed(array $result, $flow, array $context) {
if ($result['success']) {
my_module_process_result($result);
}
}
Security & Compliance
FedRAMP Compliance
Implements FedRAMP Moderate security controls:
- AC (Access Control): Role-based access with least privilege
- AU (Audit and Accountability): Comprehensive audit logging
- IA (Identification and Authentication): MFA support, session management
- SC (System and Communications Protection): Encryption, input validation
- SI (System and Information Integrity): Input validation, XSS protection
NIST 800-53 Controls
- AC-2: Account Management
- AC-3: Access Enforcement
- AU-2: Audit Events
- AU-3: Content of Audit Records
- IA-2: Identification and Authentication
- SC-7: Boundary Protection
- SC-8: Transmission Confidentiality
- SI-3: Malicious Code Protection
- SI-10: Information Input Validation
Troubleshooting
No AI providers available
composer require drupal/ai_provider_openai
drush en ai_provider_openai -y
drush cset ai.provider.openai.settings api_key "your-key" -y
Rate limit exceeded
drush cache:clear
drush cset ai_agentic_workflows.settings rate_limit_max 100 -y
Workflow timeout
// In settings.php
$config['ai_agentic_workflows.settings']['default_timeout'] = 600;
$config['ai_agentic_workflows.settings']['queue_processing'] = TRUE;
Testing
# Run tests
vendor/bin/phpunit modules/custom/ai_agentic_workflows/tests
# Check coding standards
buildkit drupal phpcs modules/custom/ai_agentic_workflows --fix
# Validate design
buildkit drupal taste modules/custom/ai_agentic_workflows
Resources
- Project: https://gitlab.bluefly.io/llm/drupal-modules/ai_agentic_workflows
- Documentation: https://gitlab.bluefly.io/llm/documentation/-/wikis/home
- Issues: https://gitlab.bluefly.io/llm/drupal-modules/ai_agentic_workflows/-/issues
- OSSA: https://gitlab.bluefly.io/llm/ossa