Environment-Aware Architecture
Eko’s architecture is designed to provide consistent capabilities across different JavaScript environments while respecting each environment’s unique constraints and opportunities. This environment-aware approach allows you to write workflows that can run everywhere while taking full advantage of environment-specific features when available.
Core Architecture
At its heart, Eko consists of three main layers:
1. Framework Core
The framework core provides the fundamental workflow management capabilities:
This layer includes:
- Workflow generation and parsing
- Tool Registration management
- Execution engine
- Hook system
The core is environment-agnostic, focusing on orchestration rather than specific capabilities.
2. Environment Bridge
Between the core and environment-specific tools sits the environment bridge. This layer:
- Detects the current environment
- Manages capability access
- Handles cross-environment communication
- Ensures security boundaries
For example, in a browser extension environment:
3. Environment-Specific Tools
Each environment provides its own set of tools optimized for that context:
Environment-Specific Behaviors
Browser Extension Environment
In a browser extension, Eko operates across multiple contexts:
-
Background Script
- Manages workflow execution
- Controls browser windows and tabs
- Handles tool registration
-
Content Scripts
- Interact with web pages
- Execute DOM manipulations
- Capture user interactions
-
Extension UI
- Provides configuration interface
- Shows execution progress
- Manages API keys and settings
Node.js Environment
In Node.js, Eko has direct access to system resources:
Web Environment
In a web browser environment, Eko operates within browser security constraints:
Security Considerations
Eko’s environment awareness includes built-in security measures:
-
Capability Isolation
- Tools can only access appropriate APIs
- Cross-origin restrictions respected
- Permissions handled per environment
-
Context Validation
- Tool inputs sanitized
- Environment capabilities checked
- Security boundaries enforced
-
Permission Management
Next Steps
- Learn about Eko’s Tool System across environments
- Understand Workflow Execution in different contexts
- Explore Browser Extension Integration