我用 RustyPaste 做 AI Agent 云端存储

在使用 AI Agent 时,经常会生成一些 文件,比如报告、结论、代码、HTML等,这些文件默认会存在本地会话中。如果想要和其他工具或Agent共享文件,或者需要跨设备交换数据等场景时,就需要一个网络文件存储服务。
我的场景是 AI Agent 每天会定时生成一份大约5分钟的最新科技的资讯 播音稿 txt 文件,然后在另外一台机器上使用 Auk(AuK 是一个拥有1.5B参数的语音生成与编辑基础模型)将文本转成语音。对于 Agent 生成的播音稿 txt 文件怎么传给 Auk,我评估了4种方案:
- 使用 GitHub 的 Gist 功能,Gist 是一个可以存储代码片段的服务,可以直接在浏览器中使用,而且免费。但是验证后发现在国内网络环境体验很不好。
- 使用对象存储(OSS),比如阿里云OSS,腾讯云COS等。但是这些服务都需要购买,并且文件上传、存储、下载都要收费成本比较高,特别是需要云AK,担心泄漏导致安全问题。
- 使用 FTP 或 Minio 文件服务,对比评估安装部署比较重,并且访问还需要单独的客户端。
- 使用 RustyPaste ,这是一个用 Rust 编写的极简文件上传与 Pastebin 服务,部署时直接挂载目录存储文件,并提供 HTTP 访问服务。
我重点关注部署简单、轻量化、人使用方便,还要AI Agent使用简单,所以最终选择了 RustyPaste 。
RustyPaste 介绍
RustyPaste 是一个用 Rust 编写的极简文件上传与 Pastebin 服务。它主打轻量、单二进制部署,无需数据库,适合个人或小团队快速搭建私有的粘贴板、日志分享或一次性密钥传递工具。
核心特性
- 极简轻量:单二进制文件,静态链接后体积约 15 MB,运行时内存占用很低(约 15 MB),非常适合部署在资源有限的服务器或容器中。
- 无需数据库:所有数据直接以普通文件形式存储在文件系统(如挂载的卷)中,备份和迁移非常简单,不存在数据库损坏或迁移的麻烦。
- 多种粘贴类型:支持普通文件、一次性粘贴(首次读取后即焚)、URL 短链接(302 跳转)以及 密码保护(基于 Argon2id 加密)。
- API 优先:所有功能都可以通过 curl 等命令行工具直接调用,方便脚本和 CI/CD 集成。
RustyPaste 的 GitHub 地址 https://github.com/orhun/rustypaste
安装 RustyPaste
安装 RustyPaste 我习惯使用 Docker 方式部署,不需要考虑操作系统和版本等问题。
对于 Docker 镜像,使用 藏云阁Image镜像仓库 国内可以直接拉取镜像。
我的 docker-compose.yaml 文件
services:
rustypaste:
container_name: rustypaste
image: registry.cncfstack.com/docker.io/orhunp/rustypaste:latest
restart: unless-stopped
ports:
- "8000:8000"
volumes:
- /data/rustypaste/upload:/app/upload
- ./config.toml:/app/config.toml
environment:
- AUTH_TOKEN=GBHG2v****U1CDJneg
在这个 docker-compose.yaml 文件中, AUTH_TOKEN 用来上传文件时的凭证,可以使用 openssl rand -base64 16 生成一个随机的字符串。 config.toml 是配置文件,启动时是强依赖的,在文章底部提供了最新版本的 config.toml 文件。
另外在启动前需要先初始化上传目录
mkdir /data/rustypaste/upload
chmod 755 /data/rustypaste -R
然后就可以使用 docker-compose up -d 启动 RustyPaste 服务了,通过 8000 端口进行访问。
关于 RustyPates 的详细使用 README.md ,也可以在镜像说明中查看 docker.io/orhunp/rustypaste
AI 使用 RustyPaste
将提示词发送给 AI Agent 后,会学习 RustyPaste 的使用方法,后续自动进行文件上传。
提示词
已经使用 rustypaste 搭建了一个简单的文件上传和访问的服务,用来存储和访问资讯内容:
1.服务项目功能使用说明: https://file.cncfstack.com/raw.githubusercontent.com/orhun/rustypaste/refs/heads/master/README.md
2.在线服务地址:https://rustypaste.cncfstack.com
3.AUTH_TOKEN=GBH********Jneg
4.文件名必须使用英文,格式固定为 `名称-日期.txt`
可以直接到服务器上查看文件列表和文件名称
tree /data/rustypaste/upload
/data/rustypaste/upload
├── oneshot
├── oneshot_url
├── protected
├── tech-daily-2026-11-04.txt
├── tech-daily-2026-11-05.txt
├── tech-daily-2026-11-06.txt
└── url
4 directories, 3 files
可以通过浏览器或curl直接访问文件内容
curl https://rustypaste.cncfstack.com/tech-daily-2026-11-06.txt
我的环境添加了nginx代理和证书配置,可以直接使用域名地址访问。
如果没有配置,可以使用机器的IP地址和http协议,如: curl http://172.16.17.32:8000/tech-daily-2026-11-06.txt
给 AI 使用最好是有个公网的 IP 地址,有些 AI Agent 在云端沙盒环境运行,无法直接访问内网IP服务。
RustyPaste config.toml 配置文件
由于容器进程启动时必须要有配置,没有配置文件启动会报错 2026-11-06T02:35:05.368806Z ERROR rustypaste: config.toml is not found, please provide a configuration file.
配置文件的 Github 路径 https://github.com/orhun/rustypaste/blob/v0.18.1/config.toml
没有特殊需求时,直接使用默认配置就行:
[config]
refresh_rate = "1s"
[server]
address = "127.0.0.1:8000"
#socket = "/run/rustypaste/rustypaste.sock"
#url = "https://paste.example.com"
#workers=4
max_content_length = "10MB"
upload_path = "./upload"
timeout = "30s"
expose_version = false
expose_list = false
#auth_tokens = [
# "super_secret_token1",
# "super_secret_token2",
#]
#delete_tokens = [
# "super_secret_token1",
# "super_secret_token3",
#]
#url_encode_filenames = true # default: true
handle_spaces = "replace" # or "encode"
[landing_page]
text = """
┬─┐┬ ┬┌─┐┌┬┐┬ ┬┌─┐┌─┐┌─┐┌┬┐┌─┐
├┬┘│ │└─┐ │ └┬┘├─┘├─┤└─┐ │ ├┤
┴└─└─┘└─┘ ┴ ┴ ┴ ┴ ┴└─┘ ┴ └─┘
Submit files via HTTP POST here:
curl -F 'file=@example.txt' <server>
This will return the URL of the uploaded file.
The server administrator might remove any pastes that they do not personally
want to host.
If you are the server administrator and want to change this page, just go
into your config file and change it! If you change the expiry time, it is
recommended that you do.
By default, pastes expire every hour. The server admin may or may not have
changed this.
Check out the GitHub repository at https://github.com/orhun/rustypaste
Command line tool is available at https://github.com/orhun/rustypaste-cli
"""
#file = "index.txt"
content_type = "text/plain; charset=utf-8"
[paste]
random_url = { type = "petname", words = 2, separator = "-" }
#random_url = { type = "alphanumeric", length = 8 }
#random_url = { type = "alphanumeric", length = 8, no_extension = true }
#random_url = { type = "alphanumeric", length = 6, suffix_mode = true }
# Number of attempts to make when a generated random name collides with an existing
# file before giving up with a "409 Conflict" response. Defaults to 5.
#random_url = { type = "petname", words = 2, separator = "-", retry_count = 5 }
default_extension = "txt"
mime_override = [
{ mime = "image/jpeg", regex = "^.*\\.jpg$" },
{ mime = "image/png", regex = "^.*\\.png$" },
{ mime = "image/svg+xml", regex = "^.*\\.svg$" },
{ mime = "video/webm", regex = "^.*\\.webm$" },
{ mime = "video/x-matroska", regex = "^.*\\.mkv$" },
{ mime = "application/octet-stream", regex = "^.*\\.bin$" },
{ mime = "text/plain", regex = "^.*\\.(log|txt|diff|sh|rs|toml)$" },
]
mime_blacklist = [
"application/x-dosexec",
"application/java-archive",
"application/java-vm",
"audio/",
]
# Additional MIME types to render as text/plain when serving files.
text_mime_overrides = [
"application/toml",
"application/yaml",
"application/x-yaml",
]
# Enable security hardening headers (X-Content-Type-Options, Content-Security-Policy).
#hardening = false
duplicate_files = true
# default_expiry = "1h"
delete_expired_files = { enabled = true, interval = "1h" }