Background
We are building a server-hosted, multi-tenant Agent platform (Spring Boot + AG-UI + CopilotKit), not a personal/laptop Harness setup.
- Runtime: Spring Boot service (
/agui/run), intended for K8s multi-replica deployment.
- Tenancy: many logged-in users;
RuntimeContext.userId injected from server-side auth (not client-trusted).
- Why RemoteFilesystemSpec + DistributedStore: by design for shared MySQL (
agentscope_sessions + agentscope_store) and Redis-backed HTTP sessions — not because we want ./data/agentscope-workspace on pod disk as source of truth.
- Ephemeral pod disk:
workspace-dir (including .index/workspace.db and session *.jsonl) lives on container/local server disk. In production we cannot rely on per-pod PVC as the primary session archive; we expect Harness offload/mirror to BaseStore as documented for Filesystem mode 1 (RemoteFilesystemSpec).
We integrate HarnessAgent + DistributedStore (MySQL JdbcStore + MysqlAgentStateStore) + AG-UI Spring Boot starter + CopilotKit for this server-side deployment.
Configuration (simplified):
agentscope:
harness:
workspace-dir: ./data/agentscope-workspace
storage:
session-table: agentscope_sessions
workspace-table: agentscope_store
agui:
server-side-memory: false
HarnessAgent.builder()
.agentId("platform_assistant")
.name("Platform Assistant") // display name differs from agentId
.distributedStore(distributedStore)
.filesystem(new RemoteFilesystemSpec().isolationScope(IsolationScope.USER))
...
What works (MySQL)
- AgentState / conversation context →
agentscope_sessions (session_id = userId:threadId) ✅
- MEMORY.md / memory/YYYY-MM-DD.md →
agentscope_store (Remote KV) ✅
App-layer workaround (server UI): we expose custom REST (/api/chat/threads, messages from AgentStateStore) because AG-UI does not hydrate CopilotKit from persisted store when server-side-memory: false.
Problem: session offload files stay on local disk
After AG-UI conversations, we see session files under local workspace on the server (not end-user machines):
{workspace}/{userId}/agents/Platform Assistant/sessions/{threadId}.jsonl
{workspace}/{userId}/agents/Platform Assistant/sessions/{threadId}.log.jsonl
But no corresponding entries appear in agentscope_store for agents/platform_assistant/sessions/.
From code reading:
SessionTree always appends to local files first, then async mirror to AbstractFilesystem (see javadoc: "local file is the working copy").
MemoryFlushMiddleware uses agent.getName() (e.g. Platform Assistant) for offload paths, while RemoteFilesystemSpec routes agents/{agentId}/sessions/ with agentId = platform_assistant.
- Path mismatch may cause mirror to hit LocalFilesystem layer instead of RemoteFilesystem → BaseStore.
Impact (server-side / multi-replica)
- Multi-replica / K8s: each pod has its own
data/agentscope-workspace; session jsonl is not shared across replicas.
- CopilotKit / AG-UI UI history: no
MESSAGES_SNAPSHOT from persisted store; we work around via agentscope_sessions, but jsonl archive gap remains for tools/audit.
- session_search tool: may not find history written on another pod.
- Contradicts mode-1 intent: we chose RemoteFilesystemSpec specifically for server deployment; local-only jsonl undermines that contract.
Questions
- Is local session jsonl intended as mandatory working copy even when
RemoteFilesystemSpec + DistributedStore are configured? Or should offload go directly to BaseStore in distributed/server mode?
- Should middleware use stable
agentId (from HarnessAgent.builder().agentId(...)) instead of agent.getName() for session paths, to match RemoteFilesystemSpec routes?
- Recommended pattern for server multi-replica:
- shared PVC for
workspace-dir?
- or emit AG-UI
MESSAGES_SNAPSHOT from AgentStateStore on /agui/run?
- or rely only on
agentscope_sessions.context and treat jsonl as optional archive?
- Any plan to integrate AG-UI
MESSAGES_SNAPSHOT with Harness AgentStateStore for thread history hydration?
Environment
- agentscope-java: 2.0.0-local (main)
- Spring Boot 3.4.x, AG-UI starter, HarnessAgent, MySQL store
- AG-UI
server-side-memory: false (avoid in-memory ThreadSessionManager for multi-replica)
- Deployment target: server-side Agent platform (not personal desktop)
Related: #2014 (userId injection for AG-UI + Harness)
Thank you!
Background
We are building a server-hosted, multi-tenant Agent platform (Spring Boot + AG-UI + CopilotKit), not a personal/laptop Harness setup.
/agui/run), intended for K8s multi-replica deployment.RuntimeContext.userIdinjected from server-side auth (not client-trusted).agentscope_sessions+agentscope_store) and Redis-backed HTTP sessions — not because we want./data/agentscope-workspaceon pod disk as source of truth.workspace-dir(including.index/workspace.dband session*.jsonl) lives on container/local server disk. In production we cannot rely on per-pod PVC as the primary session archive; we expect Harness offload/mirror to BaseStore as documented for Filesystem mode 1 (RemoteFilesystemSpec).We integrate HarnessAgent + DistributedStore (MySQL
JdbcStore+MysqlAgentStateStore) + AG-UI Spring Boot starter + CopilotKit for this server-side deployment.Configuration (simplified):
What works (MySQL)
agentscope_sessions(session_id = userId:threadId) ✅agentscope_store(Remote KV) ✅App-layer workaround (server UI): we expose custom REST (
/api/chat/threads, messages fromAgentStateStore) because AG-UI does not hydrate CopilotKit from persisted store whenserver-side-memory: false.Problem: session offload files stay on local disk
After AG-UI conversations, we see session files under local workspace on the server (not end-user machines):
But no corresponding entries appear in
agentscope_storeforagents/platform_assistant/sessions/.From code reading:
SessionTreealways appends to local files first, then async mirror toAbstractFilesystem(see javadoc: "local file is the working copy").MemoryFlushMiddlewareusesagent.getName()(e.g.Platform Assistant) for offload paths, whileRemoteFilesystemSpecroutesagents/{agentId}/sessions/withagentId = platform_assistant.Impact (server-side / multi-replica)
data/agentscope-workspace; session jsonl is not shared across replicas.MESSAGES_SNAPSHOTfrom persisted store; we work around viaagentscope_sessions, but jsonl archive gap remains for tools/audit.Questions
RemoteFilesystemSpec+DistributedStoreare configured? Or should offload go directly to BaseStore in distributed/server mode?agentId(fromHarnessAgent.builder().agentId(...)) instead ofagent.getName()for session paths, to matchRemoteFilesystemSpecroutes?workspace-dir?MESSAGES_SNAPSHOTfromAgentStateStoreon/agui/run?agentscope_sessions.contextand treat jsonl as optional archive?MESSAGES_SNAPSHOTwith HarnessAgentStateStorefor thread history hydration?Environment
server-side-memory: false(avoid in-memoryThreadSessionManagerfor multi-replica)Related: #2014 (userId injection for AG-UI + Harness)
Thank you!