Activation Processor
The Activation Processor is the core execution engine that powers agent operations in Fiberwise. It handles pattern detection, service injection, lifecycle management, and performance monitoring for all agent activations.
What is the Activation Processor?
The Activation Processor is a sophisticated execution engine that orchestrates the entire agent lifecycle from detection to completion. It provides automatic dependency injection, pattern recognition, and robust error handling for all agent operations.
Core Responsibilities:
- Agent Discovery: Automatically scans and registers agent classes and functions
- Dependency Injection: Provides services based on method signatures and type hints
- Execution Management: Handles sync/async execution patterns with proper lifecycle management
- Error Recovery: Implements retry logic, fallback mechanisms, and graceful failure handling
- Performance Monitoring: Tracks execution time, resource usage, and activation metrics
Architecture & Flow
Activation Flow
1. Detection
Scans agent files and registers available agents and functions
2. Instantiation
Creates agent instances with proper configuration and context
3. Injection
Injects required services based on method signatures
4. Execution
Runs agent logic with monitoring and error handling
5. Completion
Returns results and updates activation records
Key Features
🔧 Automatic Service Injection
The processor analyzes method signatures and automatically injects required services like LLM providers, storage, OAuth clients, and data models.
async def process_content(
self,
input_data: dict,
llm_service: LLMService, # Auto-injected
storage: StorageService # Auto-injected
) -> dict:
# Services are automatically provided
return await llm_service.generate(input_data)
📦 Entity Bundle System
Packages agents, functions, and dependencies into deployable entity bundles for distribution and scaling.
entity-bundle/
├── agents/
│ ├── my_agent.py
│ └── helper_agent.py
├── functions/
│ └── utility_functions.py
├── requirements.txt
└── bundle_manifest.yaml
⚡ Multi-Pattern Support
Supports multiple execution patterns to accommodate different agent architectures and use cases.
- Function-based: Simple function decorators
- Class-based: Full FiberAgent inheritance
- Async/Await: Native async support
- Legacy: Backward compatibility
🔄 Worker Management
Manages background workers for distributed processing with load balancing and fault tolerance.
- Automatic worker scaling
- Health monitoring
- Task distribution
- Failure recovery
Execution Patterns
Function-Based Agents
from fiberwise_sdk import agent
@agent("text-processor")
async def process_text(input_data: dict, llm_service: LLMService) -> dict:
"""Simple function-based agent with automatic injection."""
response = await llm_service.generate(
prompt=input_data.get("text", ""),
temperature=0.7
)
return {"processed_text": response}
Class-Based Agents
from fiberwise_sdk import FiberAgent
class ContentAnalyzer(FiberAgent):
"""Full agent class with lifecycle methods."""
async def initialize(self):
"""Called once when agent is first loaded."""
self.model_cache = {}
async def activate(
self,
input_data: dict,
llm_service: LLMService,
storage: StorageService
) -> dict:
"""Main activation method with dependency injection."""
analysis = await llm_service.analyze(input_data["content"])
await storage.save(f"analysis_{self.activation_id}", analysis)
return {"analysis": analysis}
async def cleanup(self):
"""Called when agent is being shut down."""
self.model_cache.clear()
Performance Monitoring
⏱️ Execution Metrics
- Activation duration
- Queue wait time
- Resource utilization
- Memory usage patterns
📊 Throughput Tracking
- Activations per second
- Concurrent execution limits
- Worker load distribution
- Bottleneck identification
🚨 Error Analysis
- Failure rate tracking
- Error categorization
- Retry success rates
- Recovery time metrics
Configuration
Processor Settings
# activation_processor.yaml
processor:
max_concurrent_activations: 100
default_timeout: 300 # seconds
retry_attempts: 3
retry_delay: 1 # seconds
worker_pool:
min_workers: 2
max_workers: 10
scale_threshold: 0.8
health_check_interval: 30
monitoring:
enable_metrics: true
metrics_interval: 10
log_level: "INFO"
performance_tracking: true
Environment Variables
# Core processor settings
FIBERWISE_MAX_CONCURRENT_ACTIVATIONS=100
FIBERWISE_DEFAULT_TIMEOUT=300
FIBERWISE_RETRY_ATTEMPTS=3
# Worker management
FIBERWISE_MIN_WORKERS=2
FIBERWISE_MAX_WORKERS=10
FIBERWISE_WORKER_SCALE_THRESHOLD=0.8
# Monitoring and logging
FIBERWISE_ENABLE_METRICS=true
FIBERWISE_LOG_LEVEL=INFO
FIBERWISE_PERFORMANCE_TRACKING=true
Troubleshooting
🐛 Common Issues
- Agent not found: Check agent registration and import paths
- Injection failures: Verify service availability and type hints
- Timeout errors: Increase timeout or optimize agent logic
- Memory issues: Review agent cleanup and resource management
🔍 Debugging Tools
- Activation logs:
fiber logs --activation-id <id>
- Processor status:
fiber status --processor
- Worker health:
fiber workers --health
- Performance metrics:
fiber metrics --processor
Next Steps
Now that you understand the Activation Processor, explore related concepts: