Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(workspace): skip agentscope deps when building the gateway image (#2803)
sxhfeee4634b110
diff --git a/src/agentscope/workspace/_docker/_make_dockerfile.py b/src/agentscope/workspace/_docker/_make_dockerfile.pyindex 651e8ef59..ecba46138 100644--- a/src/agentscope/workspace/_docker/_make_dockerfile.py+++ b/src/agentscope/workspace/_docker/_make_dockerfile.py@@ -161,7 +161,8 @@ def prepare_build_context("""extra_pip_list = list(extra_pip or [])- install_block = 'RUN uv pip install "agentscope"'+ # requirements.txt covers the gateway's imports, so skip agentscope's deps+ install_block = 'RUN uv pip install --no-deps "agentscope"'dockerfile_text = render_dockerfile(base_image=base_image,diff --git a/tests/workspace_docker_build_test.py b/tests/workspace_docker_build_test.pynew file mode 100644index 000000000..8a0a653ef--- /dev/null+++ b/tests/workspace_docker_build_test.py@@ -0,0 +1,29 @@+# -*- coding: utf-8 -*-+"""Tests for the Docker build context, which needs no Docker daemon."""+import shutil+import unittest++from agentscope.workspace._docker._make_dockerfile import (+ prepare_build_context,+)+++class DockerGatewayInstallTest(unittest.TestCase):+ """The gateway image installs agentscope without its dependencies."""++ def test_pip_install_lines(self) -> None:+ """Only requirements.txt is installed with dependencies."""+ ctx_dir, _, _ = prepare_build_context()+ dockerfile = (ctx_dir / "Dockerfile").read_text(encoding="utf-8")+ shutil.rmtree(ctx_dir, ignore_errors=True)+ self.assertListEqual(+ [+ line+ for line in dockerfile.splitlines()+ if line.startswith("RUN uv pip install")+ ],+ [+ "RUN uv pip install -r /root/.agentscope/requirements.txt",+ 'RUN uv pip install --no-deps "agentscope"',+ ],+ )