Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions components/e2b/actions/run-code/run-code.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import app from "../../e2b.app.mjs";

export default {
key: "e2b-run-code",
name: "Run Code",
description: "Run or interpret code using the E2B service. [See the documentation](https://www.npmjs.com/package/e2b).",
version: "0.0.1",
type: "action",
props: {
app,
code: {
type: "string",
label: "Code",
description: "The code that will be interpreted by the E2B service. Eg. `print('Hello, World!')`.",
},
},
async run({ $ }) {
const {
app,
code,
} = this;

const response = await app.runCode(code);

$.export("$summary", "Successfully interpreted code.");

return response;
},
};
15 changes: 10 additions & 5 deletions components/e2b/e2b.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { Sandbox } from "@e2b/code-interpreter";

export default {
type: "app",
app: "e2b",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
getSandbox() {
process.env.E2B_API_KEY = this.$auth.api_key;
return Sandbox.create();
},
async runCode(code) {
const sandbox = await this.getSandbox();
return sandbox.runCode(code);
},
},
};
};
7 changes: 5 additions & 2 deletions components/e2b/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/e2b",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream E2B Components",
"main": "e2b.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@e2b/code-interpreter": "^1.0.3"
}
}
}
64 changes: 63 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading