name: agentuity-cli-cloud-keyvalue-set description: 在键值存储中设置键和值。需要身份验证。用于Agentuity云平台操作 version: “0.0.104” license: Apache-2.0 allowed-tools: “Bash(agentuity:*)” argument-hint: “<命名空间> <键> <值> [生存时间]” metadata: command: “agentuity cloud keyvalue set” tags: “mutating updates-resource slow requires-auth”
云键值设置
在键值存储中设置键和值
前提条件
- 已通过
agentuity auth login完成身份验证 - 需要项目上下文(从项目目录运行或使用
--project-id)
用法
agentuity cloud keyvalue set <命名空间> <键> <值> [生存时间]
参数
| 参数 | 类型 | 是否必需 | 描述 |
|---|---|---|---|
<命名空间> |
字符串 | 是 | - |
<键> |
字符串 | 是 | - |
<值> |
字符串 | 是 | - |
<生存时间> |
字符串 | 否 | - |
示例
存储用户数据:
bunx @agentuity/cli kv set production user:123 '{"name":"Alice","email":"alice@example.com"}'
存储会话(1小时生存时间):
bunx @agentuity/cli kv set cache session:abc "session-data-here" --ttl 3600
缓存主页(10分钟生存时间):
bunx @agentuity/cli kv set staging cache:homepage "<!DOCTYPE html>..." --ttl 600
输出
返回JSON对象:
{
"success": "boolean",
"namespace": "string",
"key": "string",
"contentType": "string",
"durationMs": "number",
"ttl": "number"
}
| 字段 | 类型 | 描述 |
|---|---|---|
success |
布尔值 | 操作是否成功 |
namespace |
字符串 | 命名空间名称 |
key |
字符串 | 键名称 |
contentType |
字符串 | 内容类型(application/json 或 text/plain) |
durationMs |
数字 | 操作持续时间(毫秒) |
ttl |
数字 | 生存时间(秒,如果已设置) |