MCPcopy Create free account
hub / github.com/e2b-dev/code-interpreter / list_kernels

Method list_kernels

python/e2b_code_interpreter/main.py:165–177  ·  view source on GitHub ↗

List all the kernels :param timeout: Timeout for the call :return: List of kernel ids

(self, timeout: Optional[float] = TIMEOUT)

Source from the content-addressed store, hash-verified

163 raise KernelException(f"Failed to shutdown kernel {kernel_id}")
164
165 def list_kernels(self, timeout: Optional[float] = TIMEOUT) -> List[str]:
166 """
167 List all the kernels
168 :param timeout: Timeout for the call
169 :return: List of kernel ids
170 """
171 response = requests.get(
172 f"{self._sandbox.get_protocol()}://{self._sandbox.get_hostname(8888)}/api/kernels",
173 timeout=timeout,
174 )
175 if not response.ok:
176 raise KernelException(f"Failed to list kernels: {response.text}")
177 return [kernel["id"] for kernel in response.json()]
178
179 def close(self):
180 """

Callers 1

test_list_kernelsFunction · 0.80

Calls 1

KernelExceptionClass · 0.90

Tested by 1

test_list_kernelsFunction · 0.64