AS AgentScopeAPI 手册 / API Reference

MemoryStoreService

@Service @Transactional public class MemoryStoreService
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:37–269

记忆存储服务,承载智能体的部署、调度与服务化运行。位于 io.agentscope.builder.web.managed.service 包。核心成员包括 listStores、getStore、createStore、deleteStore、listMemories、getMemory。

CRUD for memory stores and versioned memory documents.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
CreateMemoryStoreRequest记录record
承载创建记忆存储请求数据的记录类型。
Request body for creating a memory store.
PutMemoryRequest记录record
承载 Put 记忆请求数据的记录类型。
Request body for writing a memory document.

字段摘要Field Summary

字段Field类型Type说明Description
RESOURCE_TYPE
staticfinal
String
资源类型字段。
Resource-type key used for `ResourceAccessService` share grants.

构造器摘要Constructor Summary

构造器Constructor说明Description
public MemoryStoreService(MemoryStoreEntityRepository storeRepository, MemoryEntityRepository memoryRepository, MemoryVersionEntityRepository versionRepository, ResourceAccessService resourceAccessService)
初始化 `MemoryStoreService` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public List<MemoryStoreDto> listStores(String ownerId)
列出 `listStores`。
Lists memory stores owned by the user.
public MemoryStoreDto getStore(String ownerId, String storeId)
获取存储。
Returns a single memory store when owned by, or shared (at least RUN) with, the caller.
public MemoryStoreDto createStore(String ownerId, CreateMemoryStoreRequest request)
创建记忆存储。
Creates a memory store.
public void deleteStore(String ownerId, String storeId)
删除存储。
Deletes a memory store and all contained memories.
public List<MemoryDto> listMemories(String ownerId, String storeId)
列出 `listMemories`。
Lists all memories in a store.
public MemoryDto getMemory(String ownerId, String storeId, String path)
返回记忆文档通过路径。
Returns a memory document by path.
public MemoryDto putMemory(String ownerId, String storeId, String path, PutMemoryRequest request)
执行 `putMemory` 方法。
Creates or updates a memory document, bumping the head version.
public void deleteMemory(String ownerId, String storeId, String path)
删除记忆。
Deletes a memory document and its version history.
public List<MemoryVersionDto> listVersions(String ownerId, String storeId, String path)
列出 `listVersions`。
Lists all versions of a memory document.
public List<ResourceShareDto> listShares(String ownerId, String storeId)
列出 `listShares`。
Lists share grants on a memory store.
public ResourceShareDto share(String ownerId, String storeId, String granteeType, String granteeId, Tier tier)
执行 `share` 方法。
Shares a memory store with a user or the whole workspace.
public void unshare(String ownerId, String storeId, String shareId)
执行 `unshare` 方法。
Revokes a share grant on a memory store.

字段详情Field Detail

RESOURCE_TYPE

public static final String RESOURCE_TYPE
staticfinal

资源类型字段。声明为 public static final String RESOURCE_TYPE。

Resource-type key used for ResourceAccessService share grants.

源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:42

构造器详情Constructor Detail

MemoryStoreService

public MemoryStoreService(MemoryStoreEntityRepository storeRepository, MemoryEntityRepository memoryRepository, MemoryVersionEntityRepository versionRepository, ResourceAccessService resourceAccessService)

初始化 MemoryStoreService 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
storeRepositoryMemoryStoreEntityRepository存储仓库(类型 `MemoryStoreEntityRepository`)。The store repository.
memoryRepositoryMemoryEntityRepository记忆仓库(类型 `MemoryEntityRepository`)。The memory repository.
versionRepositoryMemoryVersionEntityRepository版本仓库(类型 `MemoryVersionEntityRepository`)。The version repository.
resourceAccessServiceResourceAccessService资源访问服务(类型 `ResourceAccessService`)。The resource access service.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:55–64

方法详情Method Detail

listStores

public List<MemoryStoreDto> listStores(String ownerId)

列出 listStores。

Lists memory stores owned by the user.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
返回Returns List<MemoryStoreDto>
返回列出。Returns list.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:67–72

getStore

public MemoryStoreDto getStore(String ownerId, String storeId)

获取存储。

Returns a single memory store when owned by, or shared (at least RUN) with, the caller.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
storeIdString存储标识(类型 `String`)。The store id.
返回Returns MemoryStoreDto
返回MemoryStoreDto。Returns memory store dto.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:75–78

createStore

public MemoryStoreDto createStore(String ownerId, CreateMemoryStoreRequest request)

创建记忆存储。

Creates a memory store.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
requestCreateMemoryStoreRequest请求(类型 `CreateMemoryStoreRequest`)。The request.
返回Returns MemoryStoreDto
返回MemoryStoreDto。Returns memory store dto.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:81–98

deleteStore

public void deleteStore(String ownerId, String storeId)

删除存储。

Deletes a memory store and all contained memories.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
storeIdString存储标识(类型 `String`)。The store id.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:101–108

listMemories

public List<MemoryDto> listMemories(String ownerId, String storeId)

列出 listMemories。

Lists all memories in a store.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
storeIdString存储标识(类型 `String`)。The store id.
返回Returns List<MemoryDto>
返回列出。Returns list.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:111–117

getMemory

public MemoryDto getMemory(String ownerId, String storeId, String path)

返回记忆文档通过路径。

Returns a memory document by path.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
storeIdString存储标识(类型 `String`)。The store id.
pathString路径(类型 `String`)。The path.
返回Returns MemoryDto
返回MemoryDto。Returns memory dto.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:120–130

putMemory

public MemoryDto putMemory(String ownerId, String storeId, String path, PutMemoryRequest request)

执行 putMemory 方法。

Creates or updates a memory document, bumping the head version.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
storeIdString存储标识(类型 `String`)。The store id.
pathString路径(类型 `String`)。The path.
requestPutMemoryRequest请求(类型 `PutMemoryRequest`)。The request.
返回Returns MemoryDto
返回MemoryDto。Returns memory dto.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:133–170

deleteMemory

public void deleteMemory(String ownerId, String storeId, String path)

删除记忆。

Deletes a memory document and its version history.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
storeIdString存储标识(类型 `String`)。The store id.
pathString路径(类型 `String`)。The path.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:173–184

listVersions

public List<MemoryVersionDto> listVersions(String ownerId, String storeId, String path)

列出 listVersions。

Lists all versions of a memory document.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
storeIdString存储标识(类型 `String`)。The store id.
pathString路径(类型 `String`)。The path.
返回Returns List<MemoryVersionDto>
返回列出。Returns list.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:187–193

listShares

public List<ResourceShareDto> listShares(String ownerId, String storeId)

列出 listShares。

Lists share grants on a memory store.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
storeIdString存储标识(类型 `String`)。The store id.
返回Returns List<ResourceShareDto>
返回列出。Returns list.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:196–200

share

public ResourceShareDto share(String ownerId, String storeId, String granteeType, String granteeId, Tier tier)

执行 share 方法。

Shares a memory store with a user or the whole workspace.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
storeIdString存储标识(类型 `String`)。The store id.
granteeTypeStringgrantee 类型(类型 `String`)。The grantee type.
granteeIdStringgrantee 标识(类型 `String`)。The grantee id.
tierTiertier(类型 `Tier`)。The tier.
返回Returns ResourceShareDto
返回ResourceShareDto。Returns resource share dto.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:203–208

unshare

public void unshare(String ownerId, String storeId, String shareId)

执行 unshare 方法。

Revokes a share grant on a memory store.

参数Parameters
名称Name类型Type说明Description
ownerIdString所有者标识(类型 `String`)。The owner id.
storeIdString存储标识(类型 `String`)。The store id.
shareIdStringshare 标识(类型 `String`)。The share id.
源码Source io/agentscope/builder/web/managed/service/MemoryStoreService.java:211–214

嵌套类详情Nested Class Detail

CreateMemoryStoreRequest

public record CreateMemoryStoreRequest(String name, String description)

承载创建记忆存储请求数据的记录类型。位于 io.agentscope.builder.web.managed.service 包。核心成员包括 name、description。

Request body for creating a memory store.

PutMemoryRequest

public record PutMemoryRequest(String content)

承载 Put 记忆请求数据的记录类型。位于 io.agentscope.builder.web.managed.service 包。核心成员包括 content。

Request body for writing a memory document.

基于官方固定版本源码静态生成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.