diff --git a/docs/source/building_applications/tools.md b/docs/source/building_applications/tools.md index 6da1c5a6a..95c69ffa3 100644 --- a/docs/source/building_applications/tools.md +++ b/docs/source/building_applications/tools.md @@ -43,27 +43,6 @@ The tool requires an API key which can be provided either in the configuration o > **NOTE:** When using Tavily Search and Bing Search, the inference output will still display "Brave Search." This is because Llama models have been trained with Brave Search as a built-in tool. Tavily and bing is just being used in lieu of Brave search. -#### Code Interpreter - -The Code Interpreter allows execution of Python code within a controlled environment. - -```python -# Register Code Interpreter tool group -client.toolgroups.register( - toolgroup_id="builtin::code_interpreter", provider_id="code_interpreter" -) -``` - -Features: -- Secure execution environment using `bwrap` sandboxing -- Matplotlib support for generating plots -- Disabled dangerous system operations -- Configurable execution timeouts - -> ⚠️ Important: The code interpreter tool can operate in a controlled environment locally or on Podman containers. To ensure proper functionality in containerized environments: -> - The container requires privileged access (e.g., --privileged). -> - Users without sufficient permissions may encounter permission errors. (`bwrap: Can't mount devpts on /newroot/dev/pts: Permission denied`) -> - 🔒 Security Warning: Privileged mode grants elevated access and bypasses security restrictions. Use only in local, isolated, or controlled environments. #### WolframAlpha @@ -102,7 +81,7 @@ Features: - Context retrieval with token limits -> **Note:** By default, llama stack run.yaml defines toolgroups for web search, code interpreter and rag, that are provided by tavily-search, code-interpreter and rag providers. +> **Note:** By default, llama stack run.yaml defines toolgroups for web search, wolfram alpha and rag, that are provided by tavily-search, wolfram-alpha and rag providers. ## Model Context Protocol (MCP) Tools diff --git a/docs/source/distributions/remote_hosted_distro/watsonx.md b/docs/source/distributions/remote_hosted_distro/watsonx.md index 018dc2a3c..b7c89e9b0 100644 --- a/docs/source/distributions/remote_hosted_distro/watsonx.md +++ b/docs/source/distributions/remote_hosted_distro/watsonx.md @@ -22,7 +22,7 @@ The `llamastack/distribution-watsonx` distribution consists of the following pro | safety | `inline::llama-guard` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::code-interpreter`, `inline::rag-runtime`, `remote::model-context-protocol` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime`, `remote::model-context-protocol` | | vector_io | `inline::faiss` | diff --git a/docs/source/distributions/self_hosted_distro/bedrock.md b/docs/source/distributions/self_hosted_distro/bedrock.md index 302d6932b..d7aedbfb2 100644 --- a/docs/source/distributions/self_hosted_distro/bedrock.md +++ b/docs/source/distributions/self_hosted_distro/bedrock.md @@ -19,7 +19,7 @@ The `llamastack/distribution-bedrock` distribution consists of the following pro | safety | `remote::bedrock` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::code-interpreter`, `inline::rag-runtime`, `remote::model-context-protocol` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime`, `remote::model-context-protocol` | | vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | diff --git a/docs/source/distributions/self_hosted_distro/cerebras.md b/docs/source/distributions/self_hosted_distro/cerebras.md index 8f441823a..329c9b802 100644 --- a/docs/source/distributions/self_hosted_distro/cerebras.md +++ b/docs/source/distributions/self_hosted_distro/cerebras.md @@ -12,7 +12,7 @@ The `llamastack/distribution-cerebras` distribution consists of the following pr | safety | `inline::llama-guard` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::code-interpreter`, `inline::rag-runtime` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime` | | vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | diff --git a/docs/source/distributions/self_hosted_distro/fireworks.md b/docs/source/distributions/self_hosted_distro/fireworks.md index ee9ddc818..d36e94748 100644 --- a/docs/source/distributions/self_hosted_distro/fireworks.md +++ b/docs/source/distributions/self_hosted_distro/fireworks.md @@ -22,7 +22,7 @@ The `llamastack/distribution-fireworks` distribution consists of the following p | safety | `inline::llama-guard` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `remote::wolfram-alpha`, `inline::code-interpreter`, `inline::rag-runtime`, `remote::model-context-protocol` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `remote::wolfram-alpha`, `inline::rag-runtime`, `remote::model-context-protocol` | | vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | diff --git a/docs/source/distributions/self_hosted_distro/groq.md b/docs/source/distributions/self_hosted_distro/groq.md index b18be1b2f..1b2194ad8 100644 --- a/docs/source/distributions/self_hosted_distro/groq.md +++ b/docs/source/distributions/self_hosted_distro/groq.md @@ -22,7 +22,7 @@ The `llamastack/distribution-groq` distribution consists of the following provid | safety | `inline::llama-guard` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::code-interpreter`, `inline::rag-runtime` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime` | | vector_io | `inline::faiss` | diff --git a/docs/source/distributions/self_hosted_distro/meta-reference-gpu.md b/docs/source/distributions/self_hosted_distro/meta-reference-gpu.md index f58d7bbee..8b9dcec55 100644 --- a/docs/source/distributions/self_hosted_distro/meta-reference-gpu.md +++ b/docs/source/distributions/self_hosted_distro/meta-reference-gpu.md @@ -22,7 +22,7 @@ The `llamastack/distribution-meta-reference-gpu` distribution consists of the fo | safety | `inline::llama-guard` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::code-interpreter`, `inline::rag-runtime`, `remote::model-context-protocol` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime`, `remote::model-context-protocol` | | vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | diff --git a/docs/source/distributions/self_hosted_distro/ollama.md b/docs/source/distributions/self_hosted_distro/ollama.md index 2358a52a7..5d8935fe2 100644 --- a/docs/source/distributions/self_hosted_distro/ollama.md +++ b/docs/source/distributions/self_hosted_distro/ollama.md @@ -22,7 +22,7 @@ The `llamastack/distribution-ollama` distribution consists of the following prov | safety | `inline::llama-guard` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::code-interpreter`, `inline::rag-runtime`, `remote::model-context-protocol`, `remote::wolfram-alpha` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime`, `remote::model-context-protocol`, `remote::wolfram-alpha` | | vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | diff --git a/docs/source/distributions/self_hosted_distro/passthrough.md b/docs/source/distributions/self_hosted_distro/passthrough.md index 04fc9d927..39f076be4 100644 --- a/docs/source/distributions/self_hosted_distro/passthrough.md +++ b/docs/source/distributions/self_hosted_distro/passthrough.md @@ -22,7 +22,7 @@ The `llamastack/distribution-passthrough` distribution consists of the following | safety | `inline::llama-guard` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `remote::wolfram-alpha`, `inline::code-interpreter`, `inline::rag-runtime`, `remote::model-context-protocol` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `remote::wolfram-alpha`, `inline::rag-runtime`, `remote::model-context-protocol` | | vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | diff --git a/docs/source/distributions/self_hosted_distro/remote-vllm.md b/docs/source/distributions/self_hosted_distro/remote-vllm.md index 46df56008..2ff4bad5b 100644 --- a/docs/source/distributions/self_hosted_distro/remote-vllm.md +++ b/docs/source/distributions/self_hosted_distro/remote-vllm.md @@ -21,7 +21,7 @@ The `llamastack/distribution-remote-vllm` distribution consists of the following | safety | `inline::llama-guard` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::code-interpreter`, `inline::rag-runtime`, `remote::model-context-protocol`, `remote::wolfram-alpha` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime`, `remote::model-context-protocol`, `remote::wolfram-alpha` | | vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | diff --git a/docs/source/distributions/self_hosted_distro/sambanova.md b/docs/source/distributions/self_hosted_distro/sambanova.md index 76b976d78..873c3075c 100644 --- a/docs/source/distributions/self_hosted_distro/sambanova.md +++ b/docs/source/distributions/self_hosted_distro/sambanova.md @@ -19,7 +19,7 @@ The `llamastack/distribution-sambanova` distribution consists of the following p | inference | `remote::sambanova` | | safety | `inline::llama-guard` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::code-interpreter`, `inline::rag-runtime` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime` | | vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | diff --git a/docs/source/distributions/self_hosted_distro/tgi.md b/docs/source/distributions/self_hosted_distro/tgi.md index f6b14b064..7a75aa559 100644 --- a/docs/source/distributions/self_hosted_distro/tgi.md +++ b/docs/source/distributions/self_hosted_distro/tgi.md @@ -23,7 +23,7 @@ The `llamastack/distribution-tgi` distribution consists of the following provide | safety | `inline::llama-guard` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::code-interpreter`, `inline::rag-runtime`, `remote::model-context-protocol` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime`, `remote::model-context-protocol` | | vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | diff --git a/docs/source/distributions/self_hosted_distro/together.md b/docs/source/distributions/self_hosted_distro/together.md index 3ebb1f59e..adfc2c472 100644 --- a/docs/source/distributions/self_hosted_distro/together.md +++ b/docs/source/distributions/self_hosted_distro/together.md @@ -22,7 +22,7 @@ The `llamastack/distribution-together` distribution consists of the following pr | safety | `inline::llama-guard` | | scoring | `inline::basic`, `inline::llm-as-judge`, `inline::braintrust` | | telemetry | `inline::meta-reference` | -| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::code-interpreter`, `inline::rag-runtime`, `remote::model-context-protocol`, `remote::wolfram-alpha` | +| tool_runtime | `remote::brave-search`, `remote::tavily-search`, `inline::rag-runtime`, `remote::model-context-protocol`, `remote::wolfram-alpha` | | vector_io | `inline::faiss`, `remote::chromadb`, `remote::pgvector` | diff --git a/llama_stack/providers/inline/agents/meta_reference/agents.py b/llama_stack/providers/inline/agents/meta_reference/agents.py index e0cfa5b25..a87739925 100644 --- a/llama_stack/providers/inline/agents/meta_reference/agents.py +++ b/llama_stack/providers/inline/agents/meta_reference/agents.py @@ -6,7 +6,6 @@ import json import logging -import shutil import uuid from collections.abc import AsyncGenerator @@ -78,10 +77,6 @@ class MetaReferenceAgentsImpl(Agents): tool_runtime_api=self.tool_runtime_api, ) - # check if "bwrap" is available - if not shutil.which("bwrap"): - logger.warning("Warning: `bwrap` is not available. Code interpreter tool will not work correctly.") - async def create_agent( self, agent_config: AgentConfig, diff --git a/llama_stack/providers/inline/tool_runtime/code_interpreter/__init__.py b/llama_stack/providers/inline/tool_runtime/code_interpreter/__init__.py deleted file mode 100644 index d91005c6c..000000000 --- a/llama_stack/providers/inline/tool_runtime/code_interpreter/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -from typing import Any - -from .config import CodeInterpreterToolConfig - -__all__ = ["CodeInterpreterToolConfig", "CodeInterpreterToolRuntimeImpl"] - - -async def get_provider_impl(config: CodeInterpreterToolConfig, _deps: dict[str, Any]): - from .code_interpreter import CodeInterpreterToolRuntimeImpl - - impl = CodeInterpreterToolRuntimeImpl(config) - await impl.initialize() - return impl diff --git a/llama_stack/providers/inline/tool_runtime/code_interpreter/code_env_prefix.py b/llama_stack/providers/inline/tool_runtime/code_interpreter/code_env_prefix.py deleted file mode 100644 index 9c5f642ea..000000000 --- a/llama_stack/providers/inline/tool_runtime/code_interpreter/code_env_prefix.py +++ /dev/null @@ -1,131 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -import errno - -# Disabling potentially dangerous functions -import os as _os -from functools import partial - -os_funcs_to_disable = [ - "kill", - "system", - "putenv", - "remove", - "removedirs", - "rmdir", - "fchdir", - "setuid", - "fork", - "forkpty", - "killpg", - "rename", - "renames", - "truncate", - "replace", - # "unlink", # Commenting as this was blocking matpltlib from rendering plots correctly - "fchmod", - "fchown", - "chmod", - "chown", - "chroot", - "fchdir", - "lchflags", - "lchmod", - "lchown", - "chdir", -] - - -def call_not_allowed(*args, **kwargs): - raise OSError(errno.EPERM, "Call are not permitted in this environment") - - -for func_name in os_funcs_to_disable: - if hasattr(_os, func_name): - setattr(_os, func_name, partial(call_not_allowed, _func_name=f"os.{func_name}")) - -import shutil as _shutil - -for func_name in ["rmtree", "move", "chown"]: - if hasattr(_shutil, func_name): - setattr( - _shutil, - func_name, - partial(call_not_allowed, _func_name=f"shutil.{func_name}"), - ) - -import subprocess as _subprocess - - -def popen_not_allowed(*args, **kwargs): - raise _subprocess.CalledProcessError( - -1, - args[0] if args else "unknown", - stderr="subprocess.Popen is not allowed in this environment", - ) - - -_subprocess.Popen = popen_not_allowed # type: ignore - - -import atexit as _atexit -import builtins as _builtins -import io as _io -import json as _json -import sys as _sys - -# NB! The following "unused" imports crucial, make sure not not to remove -# them with linters - they're used in code_execution.py -from contextlib import ( # noqa - contextmanager as _contextmanager, -) -from multiprocessing.connection import Connection as _Connection - -# Mangle imports to avoid polluting model execution namespace. - -_IO_SINK = _io.StringIO() -_NETWORK_TIMEOUT = 5 -_NETWORK_CONNECTIONS = None - - -def _open_connections(): - global _NETWORK_CONNECTIONS - if _NETWORK_CONNECTIONS is not None: - # Ensure connections only opened once. - return _NETWORK_CONNECTIONS - req_w_fd, resp_r_fd = _sys.argv[1], _sys.argv[2] - req_con = _Connection(int(req_w_fd), readable=False) - resp_con = _Connection(int(resp_r_fd), writable=False) - _NETWORK_CONNECTIONS = (req_con, resp_con) - return _NETWORK_CONNECTIONS - - -_builtins._open_connections = _open_connections # type: ignore - - -@_atexit.register -def _close_connections(): - global _NETWORK_CONNECTIONS - if _NETWORK_CONNECTIONS is None: - return - for con in _NETWORK_CONNECTIONS: - con.close() - del _NETWORK_CONNECTIONS - - -def _network_call(request): - # NOTE: We communicate with the parent process in json, encoded - # in raw bytes. We do this because native send/recv methods use - # pickle which involves execution of arbitrary code. - _open_connections() - req_con, resp_con = _NETWORK_CONNECTIONS - - req_con.send_bytes(_json.dumps(request).encode("utf-8")) - if resp_con.poll(timeout=_NETWORK_TIMEOUT) is None: - raise Exception(f"Network request timed out: {_json.dumps(request)}") - else: - return _json.loads(resp_con.recv_bytes().decode("utf-8")) diff --git a/llama_stack/providers/inline/tool_runtime/code_interpreter/code_execution.py b/llama_stack/providers/inline/tool_runtime/code_interpreter/code_execution.py deleted file mode 100644 index 6c9765b55..000000000 --- a/llama_stack/providers/inline/tool_runtime/code_interpreter/code_execution.py +++ /dev/null @@ -1,256 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -import base64 -import json -import multiprocessing -import os -import re -import subprocess -import sys -import tempfile -import textwrap -import time -from dataclasses import dataclass -from datetime import datetime -from io import BytesIO -from pathlib import Path - -from PIL import Image - -from .utils import get_code_env_prefix - -TOOLS_ATTACHMENT_KEY = "__tools_attachment__" -TOOLS_ATTACHMENT_KEY_REGEX = re.compile(r"__tools_attachment__=(\{.*?\})") - -DIRNAME = Path(__file__).parent - -CODE_EXEC_TIMEOUT = 20 -CODE_ENV_PREFIX = get_code_env_prefix() - -STDOUTERR_SINK_WRAPPER_TEMPLATE = """\ -with _redirect_stdout(_IO_SINK), _redirect_stderr(_IO_SINK): -{code}\ -""" - -TRYEXCEPT_WRAPPER_TEMPLATE = """\ -try: -{code} -except: - pass\ -""" - - -def generate_bwrap_command(bind_dirs: list[str]) -> str: - """ - Generate the bwrap command string for binding all - directories in the current directory read-only. - """ - bwrap_args = "" - bwrap_args += "--ro-bind / / " - # Add the --dev flag to mount device files - bwrap_args += "--dev /dev " - for d in bind_dirs: - bwrap_args += f"--bind {d} {d} " - - # Add the --unshare-all flag to isolate the sandbox from the rest of the system - bwrap_args += "--unshare-all " - # Add the --die-with-parent flag to ensure the child process dies when bwrap's parent dies - bwrap_args += "--die-with-parent " - return bwrap_args - - -@dataclass -class CodeExecutionContext: - matplotlib_dump_dir: str - - -@dataclass -class CodeExecutionRequest: - scripts: list[str] - only_last_cell_stdouterr: bool = True - only_last_cell_fail: bool = True - seed: int = 0 - strip_fpaths_in_stderr: bool = True - use_bwrap: bool = True - - -class CodeExecutor: - def __init__(self, context: CodeExecutionContext): - self.context = context - - def execute(self, req: CodeExecutionRequest) -> dict: - scripts = req.scripts - for i in range(len(scripts) - 1): - if req.only_last_cell_stdouterr: - scripts[i] = STDOUTERR_SINK_WRAPPER_TEMPLATE.format(code=textwrap.indent(scripts[i], " " * 4)) - if req.only_last_cell_fail: - scripts[i] = TRYEXCEPT_WRAPPER_TEMPLATE.format(code=textwrap.indent(scripts[i], " " * 4)) - - # Seeds prefix: - seed = req.seed - seeds_prefix = f"""\ -def _set_seeds(): - import random - random.seed({seed}) - import numpy as np - np.random.seed({seed}) -_set_seeds()\ -""" - - script = "\n\n".join([seeds_prefix] + [CODE_ENV_PREFIX] + scripts) - with tempfile.TemporaryDirectory() as dpath: - code_fpath = os.path.join(dpath, "code.py") - with open(code_fpath, "w") as f: - f.write(script) - - try: - python_path = os.environ.get("PYTHONPATH", "") - env = dict( - os.environ, - PYTHONHASHSEED=str(seed), - MPLCONFIGDIR=dpath, - MPLBACKEND="module://matplotlib_custom_backend", - PYTHONPATH=f"{DIRNAME}:{python_path}", - ) - - if req.use_bwrap: - bwrap_prefix = "bwrap " + generate_bwrap_command(bind_dirs=[dpath]) - cmd = [*bwrap_prefix.split(), sys.executable, "-c", script] - else: - cmd = [sys.executable, "-c", script] - - stdout, stderr, returncode = do_subprocess( - cmd=cmd, - env=env, - ctx=self.context, - ) - - stderr = stderr.strip() - if req.strip_fpaths_in_stderr: - pattern = r'File "([^"]+)", line (\d+)' - stderr = re.sub(pattern, r"line \2", stderr) - - return { - "process_status": "completed", - "returncode": returncode, - "stdout": stdout.strip(), - "stderr": stderr, - } - - except subprocess.TimeoutExpired: - return { - "process_status": "timeout", - "stdout": "Timed out", - "stderr": "Timed out", - } - - except Exception as e: - return { - "process_status": "error", - "error_type": type(e).__name__, - "stderr": str(e), - "stdout": str(e), - } - - -def process_matplotlib_response(response, matplotlib_dump_dir: str): - image_data = response["image_data"] - # Convert the base64 string to a bytes object - images_raw = [base64.b64decode(d["image_base64"]) for d in image_data] - # Create a list of PIL images from the bytes objects - images = [Image.open(BytesIO(img)) for img in images_raw] - # Create a list of image paths - image_paths = [] - for i, img in enumerate(images): - # create new directory for each day to better organize data: - dump_dname = datetime.today().strftime("%Y-%m-%d") # noqa: DTZ002 - we don't care about timezones here since we are displaying the date - dump_dpath = Path(matplotlib_dump_dir, dump_dname) - dump_dpath.mkdir(parents=True, exist_ok=True) - # save image into a file - dump_fname = f"matplotlib_{str(time.time()).replace('.', '_')}_{i}.png" - dump_fpath = dump_dpath / dump_fname - img.save(dump_fpath, "PNG") - image_paths.append(str(dump_fpath)) - - # this is kind of convoluted, we send back this response to the subprocess which - # prints it out - info = { - "filepath": str(image_paths[-1]), - "mimetype": "image/png", - } - return f"{TOOLS_ATTACHMENT_KEY}={json.dumps(info)}" - - -def execute_subprocess_request(request, ctx: CodeExecutionContext): - "Route requests from the subprocess (via network Pipes) to the internet/tools." - if request["type"] == "matplotlib": - return process_matplotlib_response(request, ctx.matplotlib_dump_dir) - else: - raise Exception(f"Unrecognised network request type: {request['type']}") - - -def do_subprocess(*, cmd: list, env: dict, ctx: CodeExecutionContext): - # Create Pipes to be used for any external tool/network requests. - req_r, req_w = multiprocessing.Pipe(duplex=False) - resp_r, resp_w = multiprocessing.Pipe(duplex=False) - - cmd += [str(req_w.fileno()), str(resp_r.fileno())] - proc = subprocess.Popen( - cmd, - pass_fds=(req_w.fileno(), resp_r.fileno()), - text=True, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - close_fds=True, - env=env, - ) - - # Close unnecessary fds. - req_w.close() - resp_r.close() - - pipe_close = False - done_read = False - start = time.monotonic() - while proc.poll() is None and not pipe_close: - if req_r.poll(0.1): - # NB: Python pipe semantics for poll and recv mean that - # poll() returns True is a pipe is closed. - # CF old school PEP from '09 - # https://bugs.python.org/issue5573 - try: - request = json.loads(req_r.recv_bytes().decode("utf-8")) - response = execute_subprocess_request(request, ctx) - - resp_w.send_bytes(json.dumps(response).encode("utf-8")) - except EOFError: - # The request pipe is closed - set a marker to exit - # after the next attempt at reading stdout/stderr. - pipe_close = True - - try: - # If lots has been printed, pipe might be full but - # proc cannot exit until all the stdout/stderr - # been written/read. - stdout, stderr = proc.communicate(timeout=0.3) - done_read = True - except subprocess.TimeoutExpired: - # The program has not terminated. Ignore it, there - # may be more network/tool requests. - continue - if time.monotonic() - start > CODE_EXEC_TIMEOUT: - proc.terminate() - raise subprocess.TimeoutExpired(cmd, CODE_EXEC_TIMEOUT) - - if not done_read: - # Solve race condition where process terminates before - # we hit the while loop. - stdout, stderr = proc.communicate(timeout=0.3) - - resp_w.close() - req_r.close() - return stdout, stderr, proc.returncode diff --git a/llama_stack/providers/inline/tool_runtime/code_interpreter/code_interpreter.py b/llama_stack/providers/inline/tool_runtime/code_interpreter/code_interpreter.py deleted file mode 100644 index 041104040..000000000 --- a/llama_stack/providers/inline/tool_runtime/code_interpreter/code_interpreter.py +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - - -import asyncio -import logging -import os -import tempfile -from typing import Any - -from llama_stack.apis.common.content_types import URL -from llama_stack.apis.tools import ( - ListToolDefsResponse, - Tool, - ToolDef, - ToolInvocationResult, - ToolParameter, - ToolRuntime, -) -from llama_stack.providers.datatypes import ToolsProtocolPrivate - -from .code_execution import CodeExecutionContext, CodeExecutionRequest, CodeExecutor -from .config import CodeInterpreterToolConfig - -log = logging.getLogger(__name__) - - -class CodeInterpreterToolRuntimeImpl(ToolsProtocolPrivate, ToolRuntime): - def __init__(self, config: CodeInterpreterToolConfig): - self.config = config - ctx = CodeExecutionContext( - matplotlib_dump_dir=tempfile.mkdtemp(), - ) - self.code_executor = CodeExecutor(ctx) - - async def initialize(self): - pass - - async def register_tool(self, tool: Tool) -> None: - pass - - async def unregister_tool(self, tool_id: str) -> None: - return - - async def list_runtime_tools( - self, tool_group_id: str | None = None, mcp_endpoint: URL | None = None - ) -> ListToolDefsResponse: - return ListToolDefsResponse( - data=[ - ToolDef( - name="code_interpreter", - description="Execute code", - parameters=[ - ToolParameter( - name="code", - description="The code to execute", - parameter_type="string", - ), - ], - ) - ] - ) - - async def invoke_tool(self, tool_name: str, kwargs: dict[str, Any]) -> ToolInvocationResult: - script = kwargs["code"] - # Use environment variable to control bwrap usage - force_disable_bwrap = os.environ.get("DISABLE_CODE_SANDBOX", "").lower() in ("1", "true", "yes") - req = CodeExecutionRequest(scripts=[script], use_bwrap=not force_disable_bwrap) - res = await asyncio.to_thread(self.code_executor.execute, req) - pieces = [res["process_status"]] - for out_type in ["stdout", "stderr"]: - res_out = res[out_type] - if res_out != "": - pieces.extend([f"[{out_type}]", res_out, f"[/{out_type}]"]) - if out_type == "stderr": - log.error(f"ipython tool error: ↓\n{res_out}") - return ToolInvocationResult(content="\n".join(pieces)) diff --git a/llama_stack/providers/inline/tool_runtime/code_interpreter/config.py b/llama_stack/providers/inline/tool_runtime/code_interpreter/config.py deleted file mode 100644 index caf51d573..000000000 --- a/llama_stack/providers/inline/tool_runtime/code_interpreter/config.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -from typing import Any - -from pydantic import BaseModel - - -class CodeInterpreterToolConfig(BaseModel): - @classmethod - def sample_run_config(cls, __distro_dir__: str, **kwargs: Any) -> dict[str, Any]: - return {} diff --git a/llama_stack/providers/inline/tool_runtime/code_interpreter/matplotlib_custom_backend.py b/llama_stack/providers/inline/tool_runtime/code_interpreter/matplotlib_custom_backend.py deleted file mode 100644 index 6454358a5..000000000 --- a/llama_stack/providers/inline/tool_runtime/code_interpreter/matplotlib_custom_backend.py +++ /dev/null @@ -1,93 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -""" -A custom Matplotlib backend that overrides the show method to return image bytes. -""" - -import base64 -import io -import json as _json -import logging - -import matplotlib -from matplotlib.backend_bases import FigureManagerBase - -# Import necessary components from Matplotlib -from matplotlib.backends.backend_agg import FigureCanvasAgg - -log = logging.getLogger(__name__) - - -class CustomFigureCanvas(FigureCanvasAgg): - def show(self): - # Save the figure to a BytesIO object - buf = io.BytesIO() - self.print_png(buf) - image_bytes = buf.getvalue() - buf.close() - return image_bytes - - -class CustomFigureManager(FigureManagerBase): - def __init__(self, canvas, num): - super().__init__(canvas, num) - - -# Mimic module initialization that integrates with the Matplotlib backend system -def _create_figure_manager(num, *args, **kwargs): - """ - Create a custom figure manager instance. - """ - FigureClass = kwargs.pop("FigureClass", None) # noqa: N806 - if FigureClass is None: - from matplotlib.figure import Figure - - FigureClass = Figure # noqa: N806 - fig = FigureClass(*args, **kwargs) - canvas = CustomFigureCanvas(fig) - manager = CustomFigureManager(canvas, num) - return manager - - -def show(): - """ - Handle all figures and potentially return their images as bytes. - - This function iterates over all figures registered with the custom backend, - renders them as images in bytes format, and could return a list of bytes objects, - one for each figure, or handle them as needed. - """ - image_data = [] - for manager in matplotlib._pylab_helpers.Gcf.get_all_fig_managers(): - # Get the figure from the manager - fig = manager.canvas.figure - buf = io.BytesIO() # Create a buffer for the figure - fig.savefig(buf, format="png") # Save the figure to the buffer in PNG format - buf.seek(0) # Go to the beginning of the buffer - image_bytes = buf.getvalue() # Retrieve bytes value - image_base64 = base64.b64encode(image_bytes).decode("utf-8") - image_data.append({"image_base64": image_base64}) - buf.close() - - # The _open_connections method is dynamically made available to - # the interpreter by bundling code from "code_env_prefix.py" -- by literally prefixing it -- and - # then "eval"ing it within a sandboxed interpreter. - req_con, resp_con = _open_connections() # noqa: F821 - - _json_dump = _json.dumps( - { - "type": "matplotlib", - "image_data": image_data, - } - ) - req_con.send_bytes(_json_dump.encode("utf-8")) - resp = _json.loads(resp_con.recv_bytes().decode("utf-8")) - log.info(resp) - - -FigureCanvas = CustomFigureCanvas -FigureManager = CustomFigureManager diff --git a/llama_stack/providers/inline/tool_runtime/code_interpreter/utils.py b/llama_stack/providers/inline/tool_runtime/code_interpreter/utils.py deleted file mode 100644 index fabddbf0b..000000000 --- a/llama_stack/providers/inline/tool_runtime/code_interpreter/utils.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# All rights reserved. -# -# This source code is licensed under the terms described in the LICENSE file in -# the root directory of this source tree. - -import os - -DIR = os.path.dirname(os.path.realpath(__file__)) -CODE_ENV_PREFIX_FILE = os.path.join(DIR, "code_env_prefix.py") -CODE_ENV_PREFIX = None - - -def get_code_env_prefix() -> str: - global CODE_ENV_PREFIX - - if CODE_ENV_PREFIX is None: - with open(CODE_ENV_PREFIX_FILE) as f: - CODE_ENV_PREFIX = f.read() - - return CODE_ENV_PREFIX diff --git a/llama_stack/providers/registry/tool_runtime.py b/llama_stack/providers/registry/tool_runtime.py index 3140626f9..b9194810e 100644 --- a/llama_stack/providers/registry/tool_runtime.py +++ b/llama_stack/providers/registry/tool_runtime.py @@ -35,13 +35,6 @@ def available_providers() -> list[ProviderSpec]: config_class="llama_stack.providers.inline.tool_runtime.rag.config.RagToolRuntimeConfig", api_dependencies=[Api.vector_io, Api.inference], ), - InlineProviderSpec( - api=Api.tool_runtime, - provider_type="inline::code-interpreter", - pip_packages=[], - module="llama_stack.providers.inline.tool_runtime.code_interpreter", - config_class="llama_stack.providers.inline.tool_runtime.code_interpreter.config.CodeInterpreterToolConfig", - ), remote_provider_spec( api=Api.tool_runtime, adapter=AdapterSpec( diff --git a/llama_stack/templates/bedrock/bedrock.py b/llama_stack/templates/bedrock/bedrock.py index f82defb4b..bc3a9304f 100644 --- a/llama_stack/templates/bedrock/bedrock.py +++ b/llama_stack/templates/bedrock/bedrock.py @@ -29,7 +29,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -55,10 +54,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/bedrock/build.yaml b/llama_stack/templates/bedrock/build.yaml index 6c07b0478..46d5b9c69 100644 --- a/llama_stack/templates/bedrock/build.yaml +++ b/llama_stack/templates/bedrock/build.yaml @@ -26,7 +26,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/bedrock/run.yaml b/llama_stack/templates/bedrock/run.yaml index eaa1989ee..30599a6c0 100644 --- a/llama_stack/templates/bedrock/run.yaml +++ b/llama_stack/templates/bedrock/run.yaml @@ -87,9 +87,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -140,7 +137,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/cerebras/build.yaml b/llama_stack/templates/cerebras/build.yaml index ef6c43212..0498da1cd 100644 --- a/llama_stack/templates/cerebras/build.yaml +++ b/llama_stack/templates/cerebras/build.yaml @@ -27,6 +27,5 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime image_type: conda diff --git a/llama_stack/templates/cerebras/cerebras.py b/llama_stack/templates/cerebras/cerebras.py index c370fb7d0..d891502d8 100644 --- a/llama_stack/templates/cerebras/cerebras.py +++ b/llama_stack/templates/cerebras/cerebras.py @@ -34,7 +34,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", ], } @@ -77,10 +76,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/cerebras/report.md b/llama_stack/templates/cerebras/report.md index 7c09474b1..f240e354b 100644 --- a/llama_stack/templates/cerebras/report.md +++ b/llama_stack/templates/cerebras/report.md @@ -41,4 +41,3 @@ |:-----|:-----|:-----|:-----| | /create_agent_turn | rag | test_rag_agent | ✅ | | /create_agent_turn | custom_tool | test_custom_tool | ❌ | -| /create_agent_turn | code_execution | test_code_interpreter_for_attachments | ✅ | diff --git a/llama_stack/templates/cerebras/run.yaml b/llama_stack/templates/cerebras/run.yaml index bade3d24c..0731b1df9 100644 --- a/llama_stack/templates/cerebras/run.yaml +++ b/llama_stack/templates/cerebras/run.yaml @@ -93,9 +93,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -138,7 +135,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/ci-tests/build.yaml b/llama_stack/templates/ci-tests/build.yaml index a5c615f2f..a4c5893c4 100644 --- a/llama_stack/templates/ci-tests/build.yaml +++ b/llama_stack/templates/ci-tests/build.yaml @@ -27,7 +27,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/ci-tests/ci_tests.py b/llama_stack/templates/ci-tests/ci_tests.py index f6e836918..afa8a23ce 100644 --- a/llama_stack/templates/ci-tests/ci_tests.py +++ b/llama_stack/templates/ci-tests/ci_tests.py @@ -40,7 +40,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -71,10 +70,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] available_models = { "fireworks": MODEL_ENTRIES, diff --git a/llama_stack/templates/ci-tests/run.yaml b/llama_stack/templates/ci-tests/run.yaml index 1b8698c64..d9ee5b3cf 100644 --- a/llama_stack/templates/ci-tests/run.yaml +++ b/llama_stack/templates/ci-tests/run.yaml @@ -90,9 +90,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -236,7 +233,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/dell/build.yaml b/llama_stack/templates/dell/build.yaml index 05b98d56f..f5beb6c2f 100644 --- a/llama_stack/templates/dell/build.yaml +++ b/llama_stack/templates/dell/build.yaml @@ -28,6 +28,5 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime image_type: conda diff --git a/llama_stack/templates/dell/dell.py b/llama_stack/templates/dell/dell.py index 52c5a5476..a7ec5f3b8 100644 --- a/llama_stack/templates/dell/dell.py +++ b/llama_stack/templates/dell/dell.py @@ -30,7 +30,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", ], } @@ -87,10 +86,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/dell/run-with-safety.yaml b/llama_stack/templates/dell/run-with-safety.yaml index d9693c8e3..24c515112 100644 --- a/llama_stack/templates/dell/run-with-safety.yaml +++ b/llama_stack/templates/dell/run-with-safety.yaml @@ -93,9 +93,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -127,7 +124,5 @@ tool_groups: provider_id: brave-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/dell/run.yaml b/llama_stack/templates/dell/run.yaml index 2147724b9..fdece894f 100644 --- a/llama_stack/templates/dell/run.yaml +++ b/llama_stack/templates/dell/run.yaml @@ -89,9 +89,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -118,7 +115,5 @@ tool_groups: provider_id: brave-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/dev/build.yaml b/llama_stack/templates/dev/build.yaml index 726ebccca..df45f1319 100644 --- a/llama_stack/templates/dev/build.yaml +++ b/llama_stack/templates/dev/build.yaml @@ -31,7 +31,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/dev/dev.py b/llama_stack/templates/dev/dev.py index af636d891..4cf8e7d22 100644 --- a/llama_stack/templates/dev/dev.py +++ b/llama_stack/templates/dev/dev.py @@ -106,7 +106,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -149,10 +148,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] embedding_model = ModelInput( model_id="all-MiniLM-L6-v2", diff --git a/llama_stack/templates/dev/run.yaml b/llama_stack/templates/dev/run.yaml index 7a33892b1..b77650bfe 100644 --- a/llama_stack/templates/dev/run.yaml +++ b/llama_stack/templates/dev/run.yaml @@ -119,9 +119,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -432,7 +429,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/fireworks/build.yaml b/llama_stack/templates/fireworks/build.yaml index 3907eba78..7c74157ee 100644 --- a/llama_stack/templates/fireworks/build.yaml +++ b/llama_stack/templates/fireworks/build.yaml @@ -28,7 +28,6 @@ distribution_spec: - remote::brave-search - remote::tavily-search - remote::wolfram-alpha - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/fireworks/fireworks.py b/llama_stack/templates/fireworks/fireworks.py index 449f18bf7..da68475e2 100644 --- a/llama_stack/templates/fireworks/fireworks.py +++ b/llama_stack/templates/fireworks/fireworks.py @@ -40,7 +40,6 @@ def get_distribution_template() -> DistributionTemplate: "remote::brave-search", "remote::tavily-search", "remote::wolfram-alpha", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -90,10 +89,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/fireworks/report.md b/llama_stack/templates/fireworks/report.md index 2c1ccc943..b520acf8e 100644 --- a/llama_stack/templates/fireworks/report.md +++ b/llama_stack/templates/fireworks/report.md @@ -43,4 +43,3 @@ |:-----|:-----|:-----|:-----|:-----| | inline::meta-reference | /create_agent_turn | rag | test_rag_agent | ✅ | | inline::meta-reference | /create_agent_turn | custom_tool | test_custom_tool | ✅ | -| inline::meta-reference | /create_agent_turn | code_execution | test_code_interpreter_for_attachments | ✅ | diff --git a/llama_stack/templates/fireworks/run-with-safety.yaml b/llama_stack/templates/fireworks/run-with-safety.yaml index 3c1b613f5..0ab07613e 100644 --- a/llama_stack/templates/fireworks/run-with-safety.yaml +++ b/llama_stack/templates/fireworks/run-with-safety.yaml @@ -102,9 +102,6 @@ providers: provider_type: remote::wolfram-alpha config: api_key: ${env.WOLFRAM_ALPHA_API_KEY:} - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -255,7 +252,5 @@ tool_groups: provider_id: wolfram-alpha - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/fireworks/run.yaml b/llama_stack/templates/fireworks/run.yaml index 7ad98a62d..81c293a46 100644 --- a/llama_stack/templates/fireworks/run.yaml +++ b/llama_stack/templates/fireworks/run.yaml @@ -97,9 +97,6 @@ providers: provider_type: remote::wolfram-alpha config: api_key: ${env.WOLFRAM_ALPHA_API_KEY:} - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -245,7 +242,5 @@ tool_groups: provider_id: wolfram-alpha - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/groq/build.yaml b/llama_stack/templates/groq/build.yaml index 3263ce83b..800c3e3ae 100644 --- a/llama_stack/templates/groq/build.yaml +++ b/llama_stack/templates/groq/build.yaml @@ -24,6 +24,5 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime image_type: conda diff --git a/llama_stack/templates/groq/groq.py b/llama_stack/templates/groq/groq.py index 7999f95cb..4e52aa42d 100644 --- a/llama_stack/templates/groq/groq.py +++ b/llama_stack/templates/groq/groq.py @@ -33,7 +33,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", ], } @@ -72,10 +71,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/groq/run.yaml b/llama_stack/templates/groq/run.yaml index 1566cb9ca..79c350c73 100644 --- a/llama_stack/templates/groq/run.yaml +++ b/llama_stack/templates/groq/run.yaml @@ -93,9 +93,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -203,7 +200,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/hf-endpoint/build.yaml b/llama_stack/templates/hf-endpoint/build.yaml index c2eaaa05b..2a40c3909 100644 --- a/llama_stack/templates/hf-endpoint/build.yaml +++ b/llama_stack/templates/hf-endpoint/build.yaml @@ -26,7 +26,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/hf-endpoint/hf_endpoint.py b/llama_stack/templates/hf-endpoint/hf_endpoint.py index 53dc9d38f..69e037299 100644 --- a/llama_stack/templates/hf-endpoint/hf_endpoint.py +++ b/llama_stack/templates/hf-endpoint/hf_endpoint.py @@ -32,7 +32,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -79,10 +78,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/hf-endpoint/run-with-safety.yaml b/llama_stack/templates/hf-endpoint/run-with-safety.yaml index 94d280a2a..82bcaa3cf 100644 --- a/llama_stack/templates/hf-endpoint/run-with-safety.yaml +++ b/llama_stack/templates/hf-endpoint/run-with-safety.yaml @@ -98,9 +98,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -135,7 +132,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/hf-endpoint/run.yaml b/llama_stack/templates/hf-endpoint/run.yaml index 86ee5c7e1..ec7c55032 100644 --- a/llama_stack/templates/hf-endpoint/run.yaml +++ b/llama_stack/templates/hf-endpoint/run.yaml @@ -93,9 +93,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -125,7 +122,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/hf-serverless/build.yaml b/llama_stack/templates/hf-serverless/build.yaml index c0cc1e2c2..f77f8773b 100644 --- a/llama_stack/templates/hf-serverless/build.yaml +++ b/llama_stack/templates/hf-serverless/build.yaml @@ -27,7 +27,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/hf-serverless/hf_serverless.py b/llama_stack/templates/hf-serverless/hf_serverless.py index ad8a72012..ecfe2a167 100644 --- a/llama_stack/templates/hf-serverless/hf_serverless.py +++ b/llama_stack/templates/hf-serverless/hf_serverless.py @@ -32,7 +32,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -80,10 +79,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/hf-serverless/run-with-safety.yaml b/llama_stack/templates/hf-serverless/run-with-safety.yaml index 74617925b..320976e2c 100644 --- a/llama_stack/templates/hf-serverless/run-with-safety.yaml +++ b/llama_stack/templates/hf-serverless/run-with-safety.yaml @@ -98,9 +98,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -135,7 +132,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/hf-serverless/run.yaml b/llama_stack/templates/hf-serverless/run.yaml index 03484c455..2b22b20c6 100644 --- a/llama_stack/templates/hf-serverless/run.yaml +++ b/llama_stack/templates/hf-serverless/run.yaml @@ -93,9 +93,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -125,7 +122,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/llama_api/build.yaml b/llama_stack/templates/llama_api/build.yaml index 2999080a7..f97ee4091 100644 --- a/llama_stack/templates/llama_api/build.yaml +++ b/llama_stack/templates/llama_api/build.yaml @@ -27,7 +27,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/llama_api/llama_api.py b/llama_stack/templates/llama_api/llama_api.py index 20ee6d370..b4641b9da 100644 --- a/llama_stack/templates/llama_api/llama_api.py +++ b/llama_stack/templates/llama_api/llama_api.py @@ -72,7 +72,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -115,10 +114,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] embedding_model = ModelInput( model_id="all-MiniLM-L6-v2", diff --git a/llama_stack/templates/llama_api/run.yaml b/llama_stack/templates/llama_api/run.yaml index 36c54db6c..a879482d7 100644 --- a/llama_stack/templates/llama_api/run.yaml +++ b/llama_stack/templates/llama_api/run.yaml @@ -102,9 +102,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -161,7 +158,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/meta-reference-gpu/build.yaml b/llama_stack/templates/meta-reference-gpu/build.yaml index b9130fc7d..a9d03490b 100644 --- a/llama_stack/templates/meta-reference-gpu/build.yaml +++ b/llama_stack/templates/meta-reference-gpu/build.yaml @@ -26,7 +26,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/meta-reference-gpu/meta_reference.py b/llama_stack/templates/meta-reference-gpu/meta_reference.py index 8ba9fadca..95d126095 100644 --- a/llama_stack/templates/meta-reference-gpu/meta_reference.py +++ b/llama_stack/templates/meta-reference-gpu/meta_reference.py @@ -36,7 +36,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -86,10 +85,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml b/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml index f1e3a67be..180d44e0f 100644 --- a/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml +++ b/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml @@ -108,9 +108,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -145,7 +142,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/meta-reference-gpu/run.yaml b/llama_stack/templates/meta-reference-gpu/run.yaml index ac1058373..d879667e0 100644 --- a/llama_stack/templates/meta-reference-gpu/run.yaml +++ b/llama_stack/templates/meta-reference-gpu/run.yaml @@ -98,9 +98,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -130,7 +127,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/ollama/build.yaml b/llama_stack/templates/ollama/build.yaml index 37b72fc1f..88e61bf8a 100644 --- a/llama_stack/templates/ollama/build.yaml +++ b/llama_stack/templates/ollama/build.yaml @@ -26,7 +26,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol - remote::wolfram-alpha diff --git a/llama_stack/templates/ollama/ollama.py b/llama_stack/templates/ollama/ollama.py index d9f0960a2..d72d299ec 100644 --- a/llama_stack/templates/ollama/ollama.py +++ b/llama_stack/templates/ollama/ollama.py @@ -31,7 +31,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", "remote::wolfram-alpha", @@ -75,10 +74,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ToolGroupInput( toolgroup_id="builtin::wolfram_alpha", provider_id="wolfram-alpha", diff --git a/llama_stack/templates/ollama/report.md b/llama_stack/templates/ollama/report.md index 724809a59..4b2dada3a 100644 --- a/llama_stack/templates/ollama/report.md +++ b/llama_stack/templates/ollama/report.md @@ -41,4 +41,3 @@ |:-----|:-----|:-----|:-----| | /create_agent_turn | rag | test_rag_agent | ✅ | | /create_agent_turn | custom_tool | test_custom_tool | ✅ | -| /create_agent_turn | code_execution | test_code_interpreter_for_attachments | ✅ | diff --git a/llama_stack/templates/ollama/run-with-safety.yaml b/llama_stack/templates/ollama/run-with-safety.yaml index e84e46a0b..651d58117 100644 --- a/llama_stack/templates/ollama/run-with-safety.yaml +++ b/llama_stack/templates/ollama/run-with-safety.yaml @@ -91,9 +91,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -136,8 +133,6 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter - toolgroup_id: builtin::wolfram_alpha provider_id: wolfram-alpha server: diff --git a/llama_stack/templates/ollama/run.yaml b/llama_stack/templates/ollama/run.yaml index 66410a1e0..1372486fe 100644 --- a/llama_stack/templates/ollama/run.yaml +++ b/llama_stack/templates/ollama/run.yaml @@ -89,9 +89,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -126,8 +123,6 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter - toolgroup_id: builtin::wolfram_alpha provider_id: wolfram-alpha server: diff --git a/llama_stack/templates/open-benchmark/build.yaml b/llama_stack/templates/open-benchmark/build.yaml index 1db90ef27..b14e96435 100644 --- a/llama_stack/templates/open-benchmark/build.yaml +++ b/llama_stack/templates/open-benchmark/build.yaml @@ -30,7 +30,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/open-benchmark/open_benchmark.py b/llama_stack/templates/open-benchmark/open_benchmark.py index 9f4943558..d944d4eff 100644 --- a/llama_stack/templates/open-benchmark/open_benchmark.py +++ b/llama_stack/templates/open-benchmark/open_benchmark.py @@ -107,7 +107,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -145,10 +144,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] default_models = get_model_registry(available_models) + [ diff --git a/llama_stack/templates/open-benchmark/run.yaml b/llama_stack/templates/open-benchmark/run.yaml index 9acfd0e5c..30a27cbd8 100644 --- a/llama_stack/templates/open-benchmark/run.yaml +++ b/llama_stack/templates/open-benchmark/run.yaml @@ -116,9 +116,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -242,7 +239,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/passthrough/build.yaml b/llama_stack/templates/passthrough/build.yaml index fb1fb1066..f8d099070 100644 --- a/llama_stack/templates/passthrough/build.yaml +++ b/llama_stack/templates/passthrough/build.yaml @@ -28,7 +28,6 @@ distribution_spec: - remote::brave-search - remote::tavily-search - remote::wolfram-alpha - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/passthrough/passthrough.py b/llama_stack/templates/passthrough/passthrough.py index 8454e49cf..6a30625c5 100644 --- a/llama_stack/templates/passthrough/passthrough.py +++ b/llama_stack/templates/passthrough/passthrough.py @@ -38,7 +38,6 @@ def get_distribution_template() -> DistributionTemplate: "remote::brave-search", "remote::tavily-search", "remote::wolfram-alpha", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -100,10 +99,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/passthrough/run-with-safety.yaml b/llama_stack/templates/passthrough/run-with-safety.yaml index 927f808ab..a91b9fc92 100644 --- a/llama_stack/templates/passthrough/run-with-safety.yaml +++ b/llama_stack/templates/passthrough/run-with-safety.yaml @@ -102,9 +102,6 @@ providers: provider_type: remote::wolfram-alpha config: api_key: ${env.WOLFRAM_ALPHA_API_KEY:} - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -148,7 +145,5 @@ tool_groups: provider_id: wolfram-alpha - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/passthrough/run.yaml b/llama_stack/templates/passthrough/run.yaml index 40ce959ac..d1dd3b885 100644 --- a/llama_stack/templates/passthrough/run.yaml +++ b/llama_stack/templates/passthrough/run.yaml @@ -97,9 +97,6 @@ providers: provider_type: remote::wolfram-alpha config: api_key: ${env.WOLFRAM_ALPHA_API_KEY:} - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -138,7 +135,5 @@ tool_groups: provider_id: wolfram-alpha - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/remote-vllm/build.yaml b/llama_stack/templates/remote-vllm/build.yaml index b2bbf853a..4baaaf9c8 100644 --- a/llama_stack/templates/remote-vllm/build.yaml +++ b/llama_stack/templates/remote-vllm/build.yaml @@ -27,7 +27,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol - remote::wolfram-alpha diff --git a/llama_stack/templates/remote-vllm/run-with-safety.yaml b/llama_stack/templates/remote-vllm/run-with-safety.yaml index e01bca127..6931d4ba9 100644 --- a/llama_stack/templates/remote-vllm/run-with-safety.yaml +++ b/llama_stack/templates/remote-vllm/run-with-safety.yaml @@ -102,9 +102,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -143,8 +140,6 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter - toolgroup_id: builtin::wolfram_alpha provider_id: wolfram-alpha server: diff --git a/llama_stack/templates/remote-vllm/run.yaml b/llama_stack/templates/remote-vllm/run.yaml index 222097f05..05671165d 100644 --- a/llama_stack/templates/remote-vllm/run.yaml +++ b/llama_stack/templates/remote-vllm/run.yaml @@ -95,9 +95,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -131,8 +128,6 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter - toolgroup_id: builtin::wolfram_alpha provider_id: wolfram-alpha server: diff --git a/llama_stack/templates/remote-vllm/vllm.py b/llama_stack/templates/remote-vllm/vllm.py index 0f6c7659e..2782a3ea0 100644 --- a/llama_stack/templates/remote-vllm/vllm.py +++ b/llama_stack/templates/remote-vllm/vllm.py @@ -34,7 +34,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", "remote::wolfram-alpha", @@ -84,10 +83,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ToolGroupInput( toolgroup_id="builtin::wolfram_alpha", provider_id="wolfram-alpha", diff --git a/llama_stack/templates/sambanova/build.yaml b/llama_stack/templates/sambanova/build.yaml index ca5ffe618..6fd5b2905 100644 --- a/llama_stack/templates/sambanova/build.yaml +++ b/llama_stack/templates/sambanova/build.yaml @@ -17,6 +17,5 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime image_type: conda diff --git a/llama_stack/templates/sambanova/run.yaml b/llama_stack/templates/sambanova/run.yaml index dcf56b483..2bf2bf722 100644 --- a/llama_stack/templates/sambanova/run.yaml +++ b/llama_stack/templates/sambanova/run.yaml @@ -65,9 +65,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -186,7 +183,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/sambanova/sambanova.py b/llama_stack/templates/sambanova/sambanova.py index 8b91f8712..f1862221b 100644 --- a/llama_stack/templates/sambanova/sambanova.py +++ b/llama_stack/templates/sambanova/sambanova.py @@ -31,7 +31,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", ], } @@ -80,10 +79,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/tgi/build.yaml b/llama_stack/templates/tgi/build.yaml index 9fe79647c..d2ba1c3e9 100644 --- a/llama_stack/templates/tgi/build.yaml +++ b/llama_stack/templates/tgi/build.yaml @@ -27,7 +27,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/tgi/run-with-safety.yaml b/llama_stack/templates/tgi/run-with-safety.yaml index 629389f6c..3255e9c0b 100644 --- a/llama_stack/templates/tgi/run-with-safety.yaml +++ b/llama_stack/templates/tgi/run-with-safety.yaml @@ -93,9 +93,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -125,7 +122,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/tgi/run.yaml b/llama_stack/templates/tgi/run.yaml index ad1826695..179087258 100644 --- a/llama_stack/templates/tgi/run.yaml +++ b/llama_stack/templates/tgi/run.yaml @@ -92,9 +92,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -124,7 +121,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/tgi/tgi.py b/llama_stack/templates/tgi/tgi.py index 22dcc3995..2c97cbf80 100644 --- a/llama_stack/templates/tgi/tgi.py +++ b/llama_stack/templates/tgi/tgi.py @@ -34,7 +34,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -83,10 +82,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/together/build.yaml b/llama_stack/templates/together/build.yaml index 834a3ecaf..b7338795c 100644 --- a/llama_stack/templates/together/build.yaml +++ b/llama_stack/templates/together/build.yaml @@ -27,7 +27,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol - remote::wolfram-alpha diff --git a/llama_stack/templates/together/report.md b/llama_stack/templates/together/report.md index e125d5665..71ae83597 100644 --- a/llama_stack/templates/together/report.md +++ b/llama_stack/templates/together/report.md @@ -43,4 +43,3 @@ |:-----|:-----|:-----|:-----|:-----| | inline::meta-reference | /create_agent_turn | rag | test_rag_agent | ✅ | | inline::meta-reference | /create_agent_turn | custom_tool | test_custom_tool | ✅ | -| inline::meta-reference | /create_agent_turn | code_execution | test_code_interpreter_for_attachments | ✅ | diff --git a/llama_stack/templates/together/run-with-safety.yaml b/llama_stack/templates/together/run-with-safety.yaml index 34985a8a3..fe8c8e397 100644 --- a/llama_stack/templates/together/run-with-safety.yaml +++ b/llama_stack/templates/together/run-with-safety.yaml @@ -98,9 +98,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -270,8 +267,6 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter - toolgroup_id: builtin::wolfram_alpha provider_id: wolfram-alpha server: diff --git a/llama_stack/templates/together/run.yaml b/llama_stack/templates/together/run.yaml index c107d6f3f..b903fc659 100644 --- a/llama_stack/templates/together/run.yaml +++ b/llama_stack/templates/together/run.yaml @@ -93,9 +93,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -260,8 +257,6 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter - toolgroup_id: builtin::wolfram_alpha provider_id: wolfram-alpha server: diff --git a/llama_stack/templates/together/together.py b/llama_stack/templates/together/together.py index a2bd87c97..7761bd9fd 100644 --- a/llama_stack/templates/together/together.py +++ b/llama_stack/templates/together/together.py @@ -39,7 +39,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", "remote::wolfram-alpha", @@ -74,10 +73,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ToolGroupInput( toolgroup_id="builtin::wolfram_alpha", provider_id="wolfram-alpha", diff --git a/llama_stack/templates/verification/build.yaml b/llama_stack/templates/verification/build.yaml index 9f010d651..aae24c3ca 100644 --- a/llama_stack/templates/verification/build.yaml +++ b/llama_stack/templates/verification/build.yaml @@ -32,7 +32,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/verification/run.yaml b/llama_stack/templates/verification/run.yaml index d59d0cd8e..fbe491453 100644 --- a/llama_stack/templates/verification/run.yaml +++ b/llama_stack/templates/verification/run.yaml @@ -126,9 +126,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -640,7 +637,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/verification/verification.py b/llama_stack/templates/verification/verification.py index ca9210e85..b58400f26 100644 --- a/llama_stack/templates/verification/verification.py +++ b/llama_stack/templates/verification/verification.py @@ -112,7 +112,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -155,10 +154,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] embedding_model = ModelInput( model_id="all-MiniLM-L6-v2", diff --git a/llama_stack/templates/vllm-gpu/build.yaml b/llama_stack/templates/vllm-gpu/build.yaml index 8eb44dc1b..53e257f22 100644 --- a/llama_stack/templates/vllm-gpu/build.yaml +++ b/llama_stack/templates/vllm-gpu/build.yaml @@ -27,7 +27,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/vllm-gpu/run.yaml b/llama_stack/templates/vllm-gpu/run.yaml index dfe64de4a..5d3482528 100644 --- a/llama_stack/templates/vllm-gpu/run.yaml +++ b/llama_stack/templates/vllm-gpu/run.yaml @@ -97,9 +97,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -129,7 +126,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/vllm-gpu/vllm.py b/llama_stack/templates/vllm-gpu/vllm.py index 9bfeadc8d..5775138b1 100644 --- a/llama_stack/templates/vllm-gpu/vllm.py +++ b/llama_stack/templates/vllm-gpu/vllm.py @@ -31,7 +31,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -75,10 +74,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] return DistributionTemplate( diff --git a/llama_stack/templates/watsonx/build.yaml b/llama_stack/templates/watsonx/build.yaml index badd643ad..23a1ffa74 100644 --- a/llama_stack/templates/watsonx/build.yaml +++ b/llama_stack/templates/watsonx/build.yaml @@ -24,7 +24,6 @@ distribution_spec: tool_runtime: - remote::brave-search - remote::tavily-search - - inline::code-interpreter - inline::rag-runtime - remote::model-context-protocol image_type: conda diff --git a/llama_stack/templates/watsonx/run.yaml b/llama_stack/templates/watsonx/run.yaml index f4c986d6d..dddb0670c 100644 --- a/llama_stack/templates/watsonx/run.yaml +++ b/llama_stack/templates/watsonx/run.yaml @@ -91,9 +91,6 @@ providers: config: api_key: ${env.TAVILY_SEARCH_API_KEY:} max_results: 3 - - provider_id: code-interpreter - provider_type: inline::code-interpreter - config: {} - provider_id: rag-runtime provider_type: inline::rag-runtime config: {} @@ -204,7 +201,5 @@ tool_groups: provider_id: tavily-search - toolgroup_id: builtin::rag provider_id: rag-runtime -- toolgroup_id: builtin::code_interpreter - provider_id: code-interpreter server: port: 8321 diff --git a/llama_stack/templates/watsonx/watsonx.py b/llama_stack/templates/watsonx/watsonx.py index d59bb6f20..f16593051 100644 --- a/llama_stack/templates/watsonx/watsonx.py +++ b/llama_stack/templates/watsonx/watsonx.py @@ -25,7 +25,6 @@ def get_distribution_template() -> DistributionTemplate: "tool_runtime": [ "remote::brave-search", "remote::tavily-search", - "inline::code-interpreter", "inline::rag-runtime", "remote::model-context-protocol", ], @@ -49,10 +48,6 @@ def get_distribution_template() -> DistributionTemplate: toolgroup_id="builtin::rag", provider_id="rag-runtime", ), - ToolGroupInput( - toolgroup_id="builtin::code_interpreter", - provider_id="code-interpreter", - ), ] default_models = get_model_registry(available_models) diff --git a/tests/integration/agents/test_agents.py b/tests/integration/agents/test_agents.py index bd307ab19..86881ad06 100644 --- a/tests/integration/agents/test_agents.py +++ b/tests/integration/agents/test_agents.py @@ -295,6 +295,7 @@ def test_builtin_tool_code_execution(llama_stack_client_with_mocked_inference, a # This test must be run in an environment where `bwrap` is available. If you are running against a # server, this means the _server_ must have `bwrap` available. If you are using library client, then # you must have `bwrap` available in test's environment. +@pytest.mark.skip(reason="Code interpreter is currently disabled in the Stack") def test_code_interpreter_for_attachments(llama_stack_client_with_mocked_inference, agent_config): agent_config = { **agent_config,