upstash-redis-start

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Upstash Redis for Agents (
start-redis
)

面向Agent的Upstash Redis(
start-redis

A zero-config Redis database for AI agents — no signup, no UI, no SDK setup. One HTTP request returns a working endpoint + token. Databases live for 3 days unless the user claims them.
Use this when:
  • The agent needs Redis right now and the user has not given you credentials.
  • You want short-term memory across tool calls, conversation history, a sub-agent work queue, or recent-first ranked recall.
Do not use this for: production workloads, anything tied to a user account, or anything storing PII / secrets / production credentials. The database is temporary and unauthenticated until claimed.
为AI Agent打造的零配置Redis数据库——无需注册、无需UI、无需SDK配置。一次HTTP请求即可返回可用的端点+令牌。数据库默认保留3天,除非用户认领。
适用场景:
  • Agent当前需要Redis,但用户未提供凭据。
  • 你需要在工具调用间共享短期记忆、对话历史、子Agent任务队列,或按时间排序的召回功能。
请勿用于:生产工作负载、与用户账户绑定的内容,或存储PII(个人可识别信息)/机密/生产凭据。该数据库为临时存储,在被认领前未经过身份验证。

Create or re-fetch a database

创建或重新获取数据库

bash
undefined
bash
undefined

Generate a fresh UUIDv4 yourself, then POST it as the Idempotency-Key.

自行生成一个UUIDv4,然后将其作为Idempotency-Key发送POST请求。

The UUIDv4 you send becomes the database id.

你发送的UUIDv4将成为数据库ID。

curl -X POST -H "Idempotency-Key: <uuidv4>" https://upstash.com/start-redis

- Sending your own UUIDv4 makes the first call **retry-safe** — if the response is lost, retrying with the same UUID returns the same database instead of minting a duplicate.
- Re-POST with the same `Idempotency-Key` to **re-fetch credentials** for an existing database.
- The header is optional. Omit it to mint a new database with a server-generated id (returned in the response — re-fetch later by passing that id back as `Idempotency-Key`). Only UUIDv4 is accepted.

The response is markdown containing:
- `Database ID`, `Endpoint`, `Token`
- `Metrics` URL (JSON: uptime, commands, keys, throughput, memory, bandwidth)
- `Expires` date
- `Console URL` to share with the user (where they view usage and click **Claim** to keep the database)
- An inline quickstart for the body-style REST API

Parse these out of the markdown response and use them directly — there is no separate JSON envelope.
curl -X POST -H "Idempotency-Key: <uuidv4>" https://upstash.com/start-redis

- 发送自定义UUIDv4可让首次调用具备**重试安全性**——如果响应丢失,使用相同UUID重试将返回同一个数据库,而非创建重复实例。
- 使用相同的`Idempotency-Key`重新发送POST请求,可**重新获取现有数据库的凭据**。
- 该请求头为可选。若省略,将生成一个由服务器分配ID的新数据库(ID会在响应中返回——后续可将该ID作为`Idempotency-Key`传递以重新获取)。仅接受UUIDv4格式。

响应内容为markdown格式,包含:
- `Database ID`、`Endpoint`、`Token`
- `Metrics` URL(JSON格式:正常运行时间、命令数、键数量、吞吐量、内存、带宽)
- `Expires`日期
- `Console URL`(用于分享给用户,用户可在此查看使用情况并点击**Claim**认领数据库)
- 适用于body-style REST API的内置快速入门指南

直接从markdown响应中解析这些信息即可——无需单独的JSON封装。

Calling the database (body-style REST)

调用数据库(body-style REST)

The returned endpoint speaks the Upstash Redis REST API. Prefer the body-style form: POST a JSON array as the body so you don't have to URL-encode the command.
bash
undefined
返回的端点支持Upstash Redis REST API。推荐使用body-style形式:通过POST发送JSON数组作为请求体,这样无需对命令进行URL编码。
bash
undefined

SET with TTL

设置带TTL的键值对

curl https://<endpoint>
-H "Authorization: Bearer <token>"
-d '["SET","session:abc","{"step":2}","EX","3600"]'
curl https://<endpoint>
-H "Authorization: Bearer <token>"
-d '["SET","session:abc","{"step":2}","EX","3600"]'

GET

获取键值对

curl https://<endpoint>
-H "Authorization: Bearer <token>"
-d '["GET","session:abc"]'

You can also use the official SDKs against the same endpoint + token (`@upstash/redis` for TS/JS, `upstash-redis` for Python).
curl https://<endpoint>
-H "Authorization: Bearer <token>"
-d '["GET","session:abc"]'

你也可以使用官方SDK对接同一个端点+令牌(TS/JS使用`@upstash/redis`,Python使用`upstash-redis`)。

Common agent patterns

常见Agent模式

NeedCommands
Short-term memory across tool calls in one run
SET key value EX <ttl>
/
GET key
Conversation / turn-by-turn log
LPUSH chat:<user> <json>
/
LRANGE chat:<user> 0 20
Sub-agent work queue (producer/consumer)
LPUSH jobs <json>
/
RPOP jobs
Ranked memory (recent-first or score-first)
ZADD memories <score> <member>
/
ZREVRANGE memories 0 9
需求命令
单次运行中工具调用间的短期记忆
SET key value EX <ttl>
/
GET key
对话/逐轮记录
LPUSH chat:<user> <json>
/
LRANGE chat:<user> 0 20
子Agent任务队列(生产者/消费者)
LPUSH jobs <json>
/
RPOP jobs
排序记忆(按时间倒序或分数排序)
ZADD memories <score> <member>
/
ZREVRANGE memories 0 9

Tell the user

告知用户

After provisioning, surface the console URL from the response to the user. Make clear that:
  • The database expires in 3 days.
  • They can view usage at the console URL and click Claim to keep it.
  • This is unauthenticated scratch storage — don't put secrets or PII in it.
配置完成后,将响应中的console URL展示给用户。需明确说明:
  • 数据库将在3天后过期。
  • 用户可通过console URL查看使用情况,并点击Claim认领数据库以永久保留。
  • 这是未经过身份验证的临时存储——请勿存入机密或PII信息。

Reference

参考链接