You need to enable JavaScript to run this app.
文档中心
AgentKit

AgentKit

复制全文
下载 pdf
Memory
CreateMemoryCollection - 创建记忆库
复制全文
下载 pdf
CreateMemoryCollection - 创建记忆库
创建记忆库,操作说明和注意事项请参见创建记忆库。​
请求参数​
下方仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。​
Action string 必选 示例值:CreateMemoryCollection​
要执行的操作,取值:CreateMemoryCollection。​
​
Version string 必选 示例值:2025-10-30​
API的版本,取值:2025-10-30。​
​
ClientToken string 可选 示例值:333339fe****​
保证请求幂等性。由客户端自动生成一个参数值,确保不同请求间该参数值唯一,避免当调用API超时或服务器内部错误时,客户端多次重试导致重复性操作。​
取值:仅支持ASCII字符,且不能超过64个字符。​
​
Description string 可选 示例值:memory-test​
记忆库的描述。​
  • 最多允许输入200个字符。​
  • 不填默认为空。​
​
LongTermConfiguration.Strategies.N.Name string[] 必选 示例值:s_1​
长期记忆提取策略的名称。​
  • 参数 - N:表示策略的序号,取值范围:1~5。​
  • 多个字段名之间用&分隔。​
命名规则如下:​
  • 只能包含英文字符[A-Za-z]、数字和下划线“_”。​
  • 长度限制在1~48个字符之间。​
说明​
同一个记忆库中,策略名称不可以重复。​
​
LongTermConfiguration.Strategies.N.Type string[] 必选 示例值:Summary​
长期记忆提取策略的类型。​
  • 参数 - N:表示策略的序号,取值范围:1~5。​
  • 多个字段名之间用&分隔。​
  • 取值:​
  • Summary:会话摘要(会话级别)。​
  • Semantic:语义记忆(用户级别)。​
  • UserPreference:用户偏好(用户级别)。​
​
LongTermConfiguration.Strategies.N.CustomExtractionInstructions string[] 可选 示例值:Summarize facts.​
自定义策略的系统提示词(Prompt)。​
  • 参数 - N:表示策略的序号,取值范围:1~5。​
  • 最大长度不超过8000个字符。​
说明​
不含Prompt的策略即为内置策略,每种策略类型的内置策略最多只能有一个。​
​
Name string 必选 示例值:my_collection​
记忆库名称,取值:​
  • 只能包含英文字符[A-Za-z]、数字和下划线“_”。​
  • 长度限制在1~48个字符之间。​
​
ProjectName string 可选 示例值:default​
所属项目名称。​
​
ProviderType string 可选 示例值:MEM0​
记忆库类型,取值:​
  • MEM0(默认):Mem0记忆库。​
  • VIKINGDB_MEMORY:Viking长期记忆。​
​
Tags.N.Key string[] 必选 示例值:Tags.1.Key=k1​
为资源添加的用户标签的标签键。​
  • 参数 - N:表示标签键的序号,取值范围:1~20。​
  • 多个标签键之间用&分隔。​
命名规则如下:​
  • 不能以任何大小写形式的volc:或sys:开头。​
volc:或sys:开头为系统预留标签键禁止创建。​
  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。​
  • 长度限制在1~128个字符之间。​
  • 参数 - N:表示是第几个标签,取值范围:1~20。​
​
Tags.N.Value string[] 可选 示例值:Tags.1.Value=v1​
为资源添加的用户标签的标签值。​
  • 参数 - N:表示标签值的序号,取值范围:1~20。​
  • 多个标签值之间用&分隔。​
命名规则如下:​
  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。​
  • 允许为空,长度限制在0~256个字符之间。​
  • 参数 - N:表示是第几个标签,取值范围:1~20。​
​
Tags.N.Type string[] 可选 示例值:custom​
标签类型。​
  • system:系统标签。​
  • custom:用户标签。​
​
VpcConfig.VpcId string 必选 示例值:vpc-123​
私有网络ID。​
说明​
一旦设定后不支持变更。​
​
VpcConfig.SubnetIds.N string[] 可选 示例值:VpcConfig.SubnetIds.1=subnet-ddff445***​
子网ID列表。​
  • 每个子网占用一个IP用于创建网卡。​
  • 传入多个子网来实现VPC连接的高可用。​
  • 每个可用区最多传入一个子网。对于MEM0类型,最多传入一个子网。​
​
​
​
返回参数​
下方仅列出本接口特有的返回参数。更多信息请参见返回结构。​
MemoryId string 示例值:mem-17616225****​
记忆库ID。​
​
ProviderCollectionId string 示例值:mem-294775****​
已导入的记忆库ID。​
​
ProviderType string 示例值:MEM0​
记忆库类型。​
​
Status string 示例值:Ready​
记忆库状态,取值:​
  • Creating:创建中。​
  • CreateFailed:创建失败。​
  • Ready:可用。​
  • Deleting:删除中。​
  • DeleteFailed:删除失败。​
  • Deleted:资源失效。​
  • Error:错误。​
​
​
​
请求示例​
​
POST https://agentkit.cn-beijing.volcengineapi.com?Action=CreateMemoryCollection&Version=2025-10-30 HTTP/1.1​
Content-Type: application/json​
{​
{​
"Name": "test",​
"LongTermConfiguration":{​
"Strategies":[​
{​
"Type":"UserPreference",​
"Name": "default_user_preference"​
},​
{​
"Type":"Semantic",​
"Name": "custom_semantic",​
"CustomExtractionInstructions": "you are a robot, good at summarizing facts"​
},​
{​
"Type":"Summary",​
"Name": "custom_summary"​
}​
]​
},​
"ProviderType": "MEM0"​
}​
}​
​
​
返回示例​
​
{​
"ResponseMetadata": {​
"RequestId": "202106111445100102252431000052****",​
"Action": "CreateMemoryCollection",​
"Version": "2025-10-10",​
"Service": "agentkit",​
"Region": "cn-beijing"​
},​
"Result": {​
"MemoryId": "mem-1761138****",​
"ProviderCollectionId": "mem-294775****",​
"ProviderType": "MEM0",​
"Status": "Ready"​
}​
}​
​
错误码​
下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。​
​
状态码​
错误码​
错误信息​
说明​
400​
InvalidDescription.Malformed​
The specified Description is malformed.​
指定的描述格式错误。​
400​
InvalidName.Malformed​
The specified Name is malformed.​
指定的Name不合法。​
400​
InvalidProjectName.Malformed​
The specified ProjectName is malformed.​
指定的ProjectName不合法。​
400​
LimitExceeded.MaximumTags​
The number of specified Tags exceeds the maximum limit.​
指定的标签数量超过最大限制。​
400​
LimitExceeded.MinimumSubnetIds​
The number of specified SubnetIds exceeds the minimum limit.​
指定的SubnetIds超过最小限制。​
400​
MissingParameter.Key​
The required parameter Key is not supplied.​
参数Key不能为空。​
400​
MissingParameter.LongTermConfiguration​
The required parameter LongTermConfiguration is not supplied.​
参数LongTermConfiguration不能为空。​
400​
MissingParameter.Name​
The required parameter Name is not supplied.​
名称不能为空。​
400​
MissingParameter.VpcId​
The required parameter VpcId is not supplied.​
参数VpcId不能为空。​
400​
MissingParameter.StrategyName​
The required parameter StrategyName is not supplied.​
策略名称不能为空。​
400​
MissingParameter.Strategies​
At least one strategy must be specified.​
至少需要指定一个策略。​
400​
InvalidParameter.UnsupportedStrategyType​
The specified strategy type is not supported.​
指定的策略类型不支持。​
400​
InvalidParameter.StrategyName​
The strategy name must be 1-48 characters, start with a lowercase letter or underscore, contain only lowercase letters, digits, or underscores, and not begin with 'sys_'.​
策略名称必须为1-48个字符,以小写字母或下划线开头,只能包含小写字母、数字或下划线,且不能以'sys_'开头。​
400​
InvalidParameter.MemoryCollectionName​
The memory collection name contains invalid characters or exceeds the maximum length of 48 characters. Valid characters are: a-z, A-Z, 0-9, and _ (underscore).​
记忆集合名称包含无效字符或超过最大长度(48个字符)。有效字符为:a-z、A-Z、0-9、_(下划线)。​
400​
InvalidParameter.InvalidSubnets​
The specified subnet(s) is invalid.​
指定的子网是无效的,请检查是否正确。​
400​
InvalidParameter.RedundantSubnet​
Each subnet should belong to one zone only.​
每个子网只能在一个可用区,请勿重复指定子网。​
400​
QuotaExceeded.VikingMemories​
The number of Viking memory collections exceeds the maximum limit.​
Viking memory collections数量超过最大限制。​
500​
InternalError​
An internal error has occurred.​
内部错误​
​
​
最近更新时间:2026.02.14 11:21:12
这个页面对您有帮助吗?
有用
有用
无用
无用