Dive Deep into Eko
Traditional automation frameworks require detailed step-by-step instructions. Eko is fully automatic and intelligent - you simply describe your goal, and it autonomously determines the optimal execution path and provides the finial result end-to-end.
Concepts
Traditional automation frameworks typically require you to specify exact steps to ensure stable execution: “click here,” “type there,” “wait for 2 seconds.” Eko, however, takes an entirely different approach. Instead of focusing on specific actions, it allows you to describe the goal you want to accomplish, and then Eko determines how to execute it efficiently.
Eko is built on three key principles:
1. Planning
Instead of writing detailed instructions, you describe your goal in plain language. For example:
Behind the scenes, Eko:
This planning happens before any actual execution, allowing Eko to create a complete, validated plan that you can inspect or modify if needed.
2. Hierarchical structure
Eko has a hierarchical structure:
- Planning layer: excels at breaking down complex tasks into actionable steps
- Operation layer: is proficient in using tools effectively to execute tasks
This layered structure, known as the “Hierarchical planning,” is crucial for the following reasons:
- It ensures automation reliability by validating plans before execution.
- It allows for flexibility in adapting to changing conditions during execution.
- It enables independent adjustments to either the planning or execution layers without affecting the other.
3. Tool Integration and Hooks
The real work in Eko happens through tools - discrete units of capability that know how to perform specific operations. But unlike traditional automation libraries, Eko’s tools are self-describing. They tell the framework:
- What they can do
- What information they need
- What conditions they require
Meanwhile, hooks let you monitor and control the automation process at multiple levels, from high-level workflow progress to individual tool operations.
Exploring through an Example
Let’s see these concepts in action by building something real. We’ll create a workflow that processes directory contents, but pay attention to how Eko’s architectural principles manifest in the code.
Environment
First, create a new project and install dependencies:
You’ll need an API key from Anthropic to use Claude, which powers Eko’s language understanding. Create a .env
file:
Building the Workflow
Here’s our complete example, which we’ll break down piece by piece:
Let’s examine what’s happening here:
-
Framework Initialization
We’re setting up Eko with Claude 3.5 Sonnet, a balanced model good for most tasks. You might choose other models based on your needs:
claude-3-opus-20240229
for complex tasks requiring deep understandingclaude-3-5-haiku-20241022
for simpler tasks where speed is important
-
Workflow Generation
This is where Eko’s natural language understanding shines. It analyzes the request and creates a structured plan. Let’s look at the generated workflow:
Notice how Eko has:
- Identified two main tasks (listing contents and saving)
- Established the correct dependency (can’t save before listing)
- Selected appropriate tools for each task
-
Execution with Hooks
Hooks provide visibility and control over execution. You can:
- Monitor progress
- Modify inputs and outputs
- Skip tasks conditionally
- Handle errors gracefully
Extending with Custom Tools
One of Eko’s most powerful features is its extensibility. The following example requires TypeScript to run. Here’s how you can add custom capabilities:
This tool showcases several important principles:
-
Self-Description The tool describes its capabilities and requirements through its
name
,description
, andinput_schema
. This enables Eko to:- Understand when to use the tool
- Validate inputs before execution
- Generate appropriate tool combinations
-
Type Safety Using TypeScript interfaces ensures the tool integrates properly with the framework:
-
Context Awareness Tools receive an execution context that provides access to:
- Shared state
- Environment information
- Other tools’ results
After creating a tool, register it with Eko:
Now you can use it in workflows:
To see the full example in action, save format-dir.ts, set up the Typescript environment, and run:
The Built-in Tool Ecosystem
Eko comes with a rich set of built-in tools, organized by environment:
Browser Extension Tools
Tools for browser automation including:
- Web search and content extraction
- Tab management and navigation
- Element interaction and form filling
- Screenshot capture
- File export
Web Tools
A subset of browser automation tools that work in web environments:
- Element interaction
- Content extraction
- Screenshot capture
- File export
Node.js Tools
Tools for system automation:
- File operations (read/write)
- Command execution
Fellou Browser Tools
Tools for computer control in the Fellou browser environment:
- Mouse and keyboard control
- Screen capture
- System interaction
Each environment provides its own appropriate set of tools based on the available capabilities and security constraints. For complete details on available tools and their usage, see:
- Available Tools for a comprehensive reference
- Tool System Overview for understanding tool concepts
- Browser Use Guide for browser automation details
- Computer Use Guide for system automation details
Moving Beyond the Basics
Now that you understand Eko’s core concepts, you can explore more advanced topics:
Advanced Workflow Control
- Hook System for fine-grained execution control
- Error handling and recovery strategies
- State management between nodes
- Parallel execution of independent tasks
Tool Development
- Creating environment-specific tools
- Tool composition and chaining
- Handling asynchronous operations
- Error handling best practices
Environment Integration
Each of these topics is covered in depth in our detailed guides. The concepts you’ve learned here provide the foundation for understanding these more advanced capabilities.
Next Steps
Ready to dive deeper? Here’s where to go next:
- Explore browser automation in the Browser Extension Guide
- Study the Tool System in depth
- Learn about advanced patterns in the Hook System
- Understand how Eko adapts to different environments in Environment-Aware Architecture