agentscope-ai / agentscope-ai/agentscope-java

Harness always materialises .agentscope/workspace under the working directory — no opt-out for SaaS / sandboxed deployments

未關閉
#2,763 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
area/harness enhancement
主要語言
Java
星號
5.6k
分支
1.3k
平均合併
4 天 12 小時
30 天內合併 PR
77

描述

# Issue draft — post on https://github.com/agentscope-ai/agentscope-java/issues

---
**Title:** Harness always materialises `.agentscope/workspace` under the working directory — no opt-out for SaaS / sandboxed deployments

**Body:**

### Problem

`HarnessAgent` always resolves a local workspace. When `workspace(...)` is not set it falls back
to `${user.dir}/.agentscope/workspace` (see `resolveDefaultWorkspace()`), and several
workspace-backed components are wired unconditionally — the default local filesystem overlay
(`LocalFilesystemSpec`), the workspace-backed `WorkspaceMessageBus` / `WorkspaceAsyncToolRegistry`
fallbacks, the default `WorkspaceTaskRepository` (`agents//tasks`), skills staging
(`.skills-cache`), and (on `main`) transcripts under `workspace/.agentscope/transcripts`.

In a SaaS / containerised deployment where **all file IO happens inside a remote sandbox or an
in-memory / distributed store**, that local workspace is pure dead weight. Even after
`disableFilesystemTools().disableShellTool()` the harness still creates a `.agentscope` tree in
the application's working directory (and the default `JsonFileAgentStateStore` falls back to
`~/.agentscope/state/` when no state store is given). Note the project's own
`.gitignore` already ignores `.agentscope/` — the directory is known to be an unwanted
by-product, but there is no way to prevent it.

The existing escape hatches (`workspace(Path)`, `agentscope.workspace` system property,
`AGENTSCOPE_WORKSPACE` env var) only *relocate* the directory; none of the 15 `disable*`
builder switches stops the local materialisation.

### Proposed solution

Add `HarnessAgent.Builder.disableLocalWorkspace()` (feature PR #…):

- workspace resolves to an ephemeral `${java.io.tmpdir}/agentscope-workspace/` when
`workspace(...)` is unset, never `${user.dir}`;
- no default local filesystem is created (`resolveFilesystem` returns `null`);
- missing explicit `.stateStore(...)` / `.taskRepository(...)` fail fast with descriptive
errors instead of persisting to `~/.agentscope/state` / `agents//tasks`;
- transcripts and skills staging are skipped when there is no local filesystem.

Behaviour is unchanged for everyone who does not call the new switch.

### Environment

- agentscope-java `main` (2.0.3-SNAPSHOT); also present in 2.0.1/2.0.2
- JDK 17+, Windows / Linux

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。