You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A HTTP service intended as a backend for an LLM that can run arbitrary pieces of Python code.
18
-
19
-
Built from the ground up to be safe and reproducible.
9
+
<palign="left">
10
+
BeeAI Code Interpreter is a powerful HTTP service built to enable LLMs to execute arbitrary Python code. Engineered with safety and reproducibility at the core, this service is designed to seamlessly integrate with your applications.
11
+
</p>
20
12
21
13
> [!NOTE]
22
-
> This project contains submodules. Be sure to clone it with `git clone --recurse-submodules`, or initialize the submodules later with `git submodule update --init`.
14
+
> This project includes submodules. Clone it using:
15
+
> `git clone --recurse-submodules`.
16
+
>
17
+
> If you've already cloned it, initialize submodules with:
18
+
> `git submodule update --init`.
19
+
20
+
You can quickly set up BeeAI Code Interpreter locally without needing to install Python or Poetry, as everything runs inside Docker.
BeeAI Framework Python Starter helps you set up everything, including BeeAI Code Interpreter. The starter template is also available in [TypeScript](https://github.com/i-am-bee/beeai-framework-ts-starter).
27
29
28
-
It is possible to quickly spin up Bee Code Interpreter locally. It is not necessary to have Python or Poetry set up for this, since all is done using Docker.
30
+
## Installation
29
31
30
-
1. Consider using [Bee Stack](https://github.com/i-am-bee/bee-stack), which sets up everything (including Bee Code Interpreter) for you. Alternatively, to develop using Bee Agent Framework, you may use [Bee Framework Starter](https://github.com/i-am-bee/bee-agent-framework-starter). Only follow the rest of this guide if you don't want to run the full stack, or need to make some modifications to Bee Code Interpreter (like modifying the executor image).
31
-
2. Install [Rancher Desktop](https://rancherdesktop.io/) -- a local Docker and Kubernetes distribution.
32
+
If you wish to make modifications to BeeAI Code Interpreter (like modifying the executor image), continue with the following:
33
+
34
+
1.**Install Rancher Desktop:** Download and install [Rancher Desktop](https://rancherdesktop.io/), a local Docker and Kubernetes distribution.
32
35
> [!WARNING]
33
36
> If you use a different local Docker / Kubernetes environment than Rancher Desktop, you may have a harder time.
34
37
> Most of the other options (like Podman Desktop) require an additional step to make locally built images available in Kubernetes.
35
38
> In that case, you might want to check `scripts/run-pull.sh` and modify it accordingly.
36
-
3. If you already use `kubectl` to manage Kubernetes clusters, ensure that you have the correct context selected in `kubectl`.
37
-
4. Run one of the following commands to spin up Bee Code Interpreter in the active `kubectl` context:
39
+
40
+
2.**Verify kubectl Context:** If you're using `kubectl` to manage Kubernetes clusters, make sure the correct context is context.
41
+
42
+
3.**Run BeeAI Code Interpreter:** Run one of the following commands to spin up BeeAI Code Interpreter in the active `kubectl` context:
38
43
-**Use a pre-built image** (recommended if you made no changes): `bash scripts/run-pull.sh`
> Building the image locally make take a long time -- up to a few hours on slower machines.
42
-
5. Once the service is running, you can interact with it using the HTTP API described below.
47
+
48
+
4.**Interacting with the Service:** Once the service is running, you can interact with it using the HTTP API described below.
43
49
44
50
---
45
51
@@ -49,7 +55,12 @@ The service exposes the following HTTP endpoints:
49
55
50
56
### Execute Code
51
57
52
-
Executes arbitrary Python code in a sandboxed environment. All `import`s are checked and missing libraries are installed on-the-fly. `file_hash` refers to the hash-based filename as used in the storage folder.
58
+
This endpoint executes arbitrary Python code in a sandboxed environment, with on-the-fly installation of any missing libraries.
59
+
60
+
> [!NOTE]
61
+
> All `import`s are checked and missing libraries are installed on-the-fly.
62
+
>
63
+
> `file_hash` refers to the hash-based filename as used in the storage folder.
53
64
54
65
**Endpoint:**`POST /v1/execute`
55
66
@@ -80,7 +91,7 @@ Executes arbitrary Python code in a sandboxed environment. All `import`s are che
80
91
81
92
### Parse Custom Tool
82
93
83
-
Parses a custom tool definition and returns its metadata.
94
+
This endpoint parses a custom tool definition and returns its metadata.
84
95
85
96
**Endpoint:**`POST /v1/parse-custom-tool`
86
97
@@ -102,7 +113,7 @@ Parses a custom tool definition and returns its metadata.
102
113
103
114
### Execute Custom Tool
104
115
105
-
Executes a custom tool with provided input.
116
+
This endpoint executes a custom tool with the provided input.
106
117
107
118
**Endpoint:**`POST /v1/execute-custom-tool`
108
119
@@ -143,9 +154,11 @@ curl -X POST http://localhost:50081/v1/execute \
143
154
144
155
## 🧳 Production setup
145
156
146
-
All configuration options are defined and described in `src/code_interpreter/config.py`. You can override them using environment variables with `APP_` prefix, e.g. `APP_EXECUTOR_IMAGE` to override `executor_image`.
157
+
To configure BeeAI Code Interpreter for production:
158
+
159
+
1. All configuration options are located in `src/code_interpreter/config.py`. Override them using environment variables with `APP_` prefix, e.g. `APP_EXECUTOR_IMAGE` to override `executor_image`.
147
160
148
-
For a production setup, ensure that you have the following:
161
+
2.For production deployment, ensure the following:
149
162
- A Kubernetes cluster with a secure container runtime (gVisor, Kata Containers, Firecracker, etc.)
150
163
> ⚠️ Docker containers are not fully sandboxed by default. To protect from malicious attackers, do not skip this step.
151
164
- A service account, bound to the pod where `bee-code-interpreter` is running, with permissions to manage pods in the namespace it is configured to use.
0 commit comments