Skip to content

🚀 Dify.ai x e2b.dev Custom Tool: Seamlessly run custom scripts in Dify using `e2b.dev`’s flexible sandbox environments! Choose languages, use preloaded packages via Template IDs, and enjoy streamlined setup without source code changes.

Notifications You must be signed in to change notification settings

LogicOber/dify-e2b-custom-tool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dify.ai Showcase: Integrating Custom e2b.dev Tool

Overview

Demo Here The following outlines the custom integration of e2b.dev tools within Dify.ai. This configuration enables a flexible environment for executing scripts with specific pre-configured settings. Below are key parameters essential for using e2b.dev within Dify. You can import the DSL from Matlab Scientists Demo.yml

1️⃣ Code to Execute

The first parameter is the code itself, representing the complete script or program you intend to run. For example, if you are using Python to solve a computation problem, you would import the necessary Python packages, perform the computation, and then output the results.

2️⃣ Programming Language

The programming language for the code is selectable via a dropdown menu. e2b.dev supports several languages, including Python, JavaScript, R, Java, and Bash. In this setup, Python is pre-selected, but it can be changed by modifying the dropdown. Alternatively, you could alter the source code to allow this parameter to be set dynamically rather than predefined.

3️⃣ Template ID

For Python, an essential feature of e2b.dev is its ability to preload specific Python packages and package them within different Sandbox environments. You can reference these environments by their Template ID. By specifying the Template ID, users can seamlessly invoke a predefined environment loaded with specific packages.

4️⃣ Flexibility with Environment Specification

One advantage of using Template IDs to specify environments is that it allows users to switch environments without needing to modify Dify’s Source Code for each Python package. This setup is particularly useful for users who may require flexibility in environment specification across different machines, as they can simply use the API key and Template ID for similar results. This approach may offer more flexibility than Dify’s native Sandbox but requires more maintenance for source code compatibility with Dify. Ideally, future improvements could include simplified user-defined Tool integrations within Dify.

Note

  • The showcased code here is experimental and was fully generated by Claude.ai. Many thanks to it for the contribution. 🙏
  • Please note that you need to run Dify using the source code startup method. The tutorial can be found here. Additionally, you will need to use poetry to install the e2b.dev python sdk.

About

🚀 Dify.ai x e2b.dev Custom Tool: Seamlessly run custom scripts in Dify using `e2b.dev`’s flexible sandbox environments! Choose languages, use preloaded packages via Template IDs, and enjoy streamlined setup without source code changes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages