Package io.agentscope.extensions.jdbc
Class JdbcDistributedStore
java.lang.Object
io.agentscope.extensions.jdbc.JdbcDistributedStore
- All Implemented Interfaces:
io.agentscope.harness.agent.DistributedStore
public class JdbcDistributedStore
extends Object
implements io.agentscope.harness.agent.DistributedStore
Multi-database JDBC-backed
DistributedStore with automatic dialect detection.
Pass any JDBC DataSource and the store auto-detects the database via
AbstractJdbcDialect.from(DataSource), then assembles all four components:
JdbcAgentStateStore— agent session stateJdbcStore— workspace filesystem KVJdbcSnapshotSpec— sandbox snapshots as BLOBsJdbcSandboxExecutionGuard— distributed lock via the dialect's lock strategy
Usage
DataSource dataSource = ... // HikariCP, Druid, etc.
HarnessAgent agent = HarnessAgent.builder()
.name("my-agent")
.model("dashscope:qwen-plus")
.distributedStore(JdbcDistributedStore.create(dataSource))
.filesystem(new DockerFilesystemSpec()
.image("ubuntu:24.04"))
.build();
- Author:
- shanhongyu
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.agentscope.harness.agent.DistributedStore
io.agentscope.harness.agent.DistributedStore.Builder, io.agentscope.harness.agent.DistributedStore.CompositeDistributedStore -
Method Summary
Modifier and TypeMethodDescriptionio.agentscope.core.state.AgentStateStoreio.agentscope.harness.agent.filesystem.remote.store.BaseStorestatic JdbcDistributedStorecreate(DataSource dataSource) Creates a JDBC distributed store with auto-detected dialect and table creation.static JdbcDistributedStorecreate(DataSource dataSource, AbstractJdbcDialect dialect) Creates a JDBC distributed store with an explicitly provided dialect.io.agentscope.harness.agent.sandbox.SandboxExecutionGuardio.agentscope.harness.agent.sandbox.snapshot.SandboxSnapshotSpecMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.agentscope.harness.agent.DistributedStore
asyncToolRegistry, messageBus, sessionTurnGate, taskRepository, teamClient
-
Method Details
-
create
Creates a JDBC distributed store with auto-detected dialect and table creation.- Parameters:
dataSource- the JDBC data source for any supported database- Returns:
- a new distributed store
-
create
Creates a JDBC distributed store with an explicitly provided dialect.- Parameters:
dataSource- the JDBC data sourcedialect- the pre-built dialect (skips auto-detection)- Returns:
- a new distributed store
-
agentStateStore
public io.agentscope.core.state.AgentStateStore agentStateStore()- Specified by:
agentStateStorein interfaceio.agentscope.harness.agent.DistributedStore
-
baseStore
public io.agentscope.harness.agent.filesystem.remote.store.BaseStore baseStore()- Specified by:
baseStorein interfaceio.agentscope.harness.agent.DistributedStore
-
sandboxSnapshotSpec
public io.agentscope.harness.agent.sandbox.snapshot.SandboxSnapshotSpec sandboxSnapshotSpec()- Specified by:
sandboxSnapshotSpecin interfaceio.agentscope.harness.agent.DistributedStore
-
sandboxExecutionGuard
public io.agentscope.harness.agent.sandbox.SandboxExecutionGuard sandboxExecutionGuard()- Specified by:
sandboxExecutionGuardin interfaceio.agentscope.harness.agent.DistributedStore
-