Package io.agentscope.extensions.redis
Class RedisDistributedStore
java.lang.Object
io.agentscope.extensions.redis.RedisDistributedStore
- All Implemented Interfaces:
io.agentscope.harness.agent.DistributedStore
public class RedisDistributedStore
extends Object
implements io.agentscope.harness.agent.DistributedStore
Redis-backed
DistributedStore that configures all distributed storage components
with a single Jedis connection.
Usage:
JedisPooled jedis = new JedisPooled("redis://localhost:6379");
RedisDistributedStore store = RedisDistributedStore.fromJedis(jedis);
HarnessAgent agent = HarnessAgent.builder()
.name("my-agent")
.model("dashscope:qwen-plus")
.distributedStore(store)
.filesystem(new RemoteFilesystemSpec(store.baseStore())
.isolationScope(IsolationScope.USER))
.build();
This provides:
RedisAgentStateStore— agent session state (auto-wired by distributedStore)RedisStore— workspace filesystem KV (viabaseStore())RedisSnapshotSpec— sandbox snapshot storage (auto-wired for sandbox mode)RedisSandboxExecutionGuard— sandbox concurrency lock (auto-wired for sandbox mode)
-
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 RedisDistributedStorefromJedis(redis.clients.jedis.UnifiedJedis jedis) Creates a Redis distributed store from a Jedis client with the default key prefix.static RedisDistributedStoreCreates a Redis distributed store from a Jedis client with a custom key prefix.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
-
fromJedis
Creates a Redis distributed store from a Jedis client with the default key prefix.- Parameters:
jedis- initialized Jedis client (e.g.new JedisPooled("redis://localhost:6379"))- Returns:
- a new Redis distributed store
-
fromJedis
public static RedisDistributedStore fromJedis(redis.clients.jedis.UnifiedJedis jedis, String keyPrefix) Creates a Redis distributed store from a Jedis client with a custom key prefix.- Parameters:
jedis- initialized Jedis clientkeyPrefix- prefix for all Redis keys (e.g."myapp:")- Returns:
- a new Redis 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
-