AS AgentScopeAPI 手册 / API Reference

RedisDistributedStore

public class RedisDistributedStore implements DistributedStore
源码Source io/agentscope/extensions/redis/RedisDistributedStore.java:56–109

Redis 分布式存储,负责持久化与读取数据。位于 io.agentscope.extensions.redis 包,实现 DistributedStore。核心成员包括 fromJedis、agentStateStore、baseStore、sandboxSnapshotSpec、sandboxExecutionGuard。

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 (via #baseStore())

  • RedisSnapshotSpec — sandbox snapshot storage (auto-wired for sandbox mode)

  • RedisSandboxExecutionGuard — sandbox concurrency lock (auto-wired for sandbox mode)

方法摘要Method Summary

方法Method说明Description
public static RedisDistributedStore fromJedis(UnifiedJedis jedis)
static
设置该参数。
Creates a Redis distributed store from a Jedis client with the default key prefix.
public static RedisDistributedStore fromJedis(UnifiedJedis jedis, String keyPrefix)
static
执行 `fromJedis` 方法。
Creates a Redis distributed store from a Jedis client with a custom key prefix.
public AgentStateStore agentStateStore()
返回智能体状态存储。
Returns the agent state store.
public BaseStore baseStore()
返回基类存储。
Returns the base store.
public SandboxSnapshotSpec sandboxSnapshotSpec()
返回沙箱快照规格。
Returns the sandbox snapshot spec.
public SandboxExecutionGuard sandboxExecutionGuard()
返回沙箱执行守卫。
Returns the sandbox execution guard.

方法详情Method Detail

fromJedis

public static RedisDistributedStore fromJedis(UnifiedJedis jedis)
static

设置该参数。

Creates a Redis distributed store from a Jedis client with the default key prefix.

参数Parameters
名称Name类型Type说明Description
jedisUnifiedJedisjedis(类型 `UnifiedJedis`)。initialized Jedis client (e.g. `new JedisPooled("redis://localhost:6379")`)
返回Returns RedisDistributedStore
返回RedisDistributedStore。a new Redis distributed store
源码Source io/agentscope/extensions/redis/RedisDistributedStore.java:72–74

fromJedis

public static RedisDistributedStore fromJedis(UnifiedJedis jedis, String keyPrefix)
static

执行 fromJedis 方法。

Creates a Redis distributed store from a Jedis client with a custom key prefix.

参数Parameters
名称Name类型Type说明Description
jedisUnifiedJedisjedis(类型 `UnifiedJedis`)。initialized Jedis client
keyPrefixString键 Prefix(类型 `String`)。prefix for all Redis keys (e.g. `"myapp:"`)
返回Returns RedisDistributedStore
返回RedisDistributedStore。a new Redis distributed store
源码Source io/agentscope/extensions/redis/RedisDistributedStore.java:83–85

agentStateStore

public AgentStateStore agentStateStore()

返回智能体状态存储。

Returns the agent state store.

返回Returns AgentStateStore
返回AgentStateStore。Returns agent state store.
源码Source io/agentscope/extensions/redis/RedisDistributedStore.java:87–93

baseStore

public BaseStore baseStore()

返回基类存储。

Returns the base store.

返回Returns BaseStore
返回BaseStore。Returns base store.
源码Source io/agentscope/extensions/redis/RedisDistributedStore.java:95–98

sandboxSnapshotSpec

public SandboxSnapshotSpec sandboxSnapshotSpec()

返回沙箱快照规格。

Returns the sandbox snapshot spec.

返回Returns SandboxSnapshotSpec
返回SandboxSnapshotSpec。Returns sandbox snapshot spec.
源码Source io/agentscope/extensions/redis/RedisDistributedStore.java:100–103

sandboxExecutionGuard

public SandboxExecutionGuard sandboxExecutionGuard()

返回沙箱执行守卫。

Returns the sandbox execution guard.

返回Returns SandboxExecutionGuard
返回SandboxExecutionGuard。Returns sandbox execution guard.
源码Source io/agentscope/extensions/redis/RedisDistributedStore.java:105–108

继承成员Inherited Members

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.