Skip to content

bug(ops): Server Docker image crashes on import of agentscope._pricing #35

Description

@purvanshjoshi

Severity

High

Impact

docker compose up — the README's recommended one-command setup — fails to start the server. The container exits immediately with ModuleNotFoundError, so neither the backend nor the UI (which depends on it) is usable via Docker. The manual pip install -r requirements.txt path in the README fails the same way.

Description

The server imports from the SDK package at module load time:

  • packages/server/main.py line 16: from agentscope._pricing import calculate_cost as _calculate_llm_cost
  • packages/server/routers/sessions.py line 21: from agentscope._pricing import calculate_cost as _calculate_llm_cost

agentscope is the Python SDK package (project name agentscope-sdk, defined in packages/sdk/pyproject.toml). It is NOT declared anywhere in the server's dependency graph:

  • packages/server/requirements.txt lists only fastapi, uvicorn, sqlalchemy, pydantic, websockets, python-dotenv, aiosqlite, greenlet — no agentscope-sdk.
  • packages/server/Dockerfile installs only requirements.txt and copies only the server source (COPY . . from the server context), so no agentscope/ module exists on the container's sys.path.

The CI server-test job only passes because it runs pip install -e packages/sdk before pytest, which masks the failure from CI.

Sub-Issues

  • Sub-Issue 2.1: Remove the server->SDK import coupling
    Vendor the pricing logic into the server package (e.g. packages/server/pricing.py) so the server has no hidden dependency on the SDK, or add agentscope-sdk to requirements.txt if coupling is intended.
  • Sub-Issue 2.2: Verify Docker builds and boots
    Run docker compose build and docker compose up, then confirm GET http://localhost:8765/health returns 200 and a session can be created.
  • Sub-Issue 2.3: Add a CI job for the Docker image
    Build (and ideally boot) the server image in CI so import/coupling regressions fail loudly instead of being hidden by the pip install.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendIssues related to the FastAPI server backendbugSomething isn't workingopsIssues related to operations and deployment (Docker, CI/CD)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions