AgenticLetters
Send physical letters anywhere in Germany via the agentic-letters.com API.
Your PDF gets printed, put in an envelope, and mailed — one API call, one real letter.
When to use
- - User wants to send a physical letter, cancellation, or legal notice
- User needs to mail a document (PDF) to a German address
- User says "send a letter", "Kündigung schicken", "Brief versenden" or something similar
- User wants to mail a DSGVO request, cancellation, complaint, or greeting card
Setup
CODEBLOCK0
Getting an API key
AgenticLetters has no account system and no login. The flow is:
- 1. Go to https://agentic-letters.com/buy
- Enter an email address and pick a credit package
- Pay via Stripe (card)
- The API key (starts with
al_) is sent to that email immediately
The key is a Bearer token used in every request. If the user buys more credits later with the same email, the existing key gets topped up — no new key issued. If the user doesn't have a key yet, guide them to https://agentic-letters.com/buy.
Tool
INLINECODE1 — a zero-dependency Python CLI (stdlib only).
Send a letter
- 1. Generate an A4 PDF (max 3 pages, max 10 MB, black & white print)
- Run the tool:
CODEBLOCK1
Optional flags:
- -
--type <type> — letter type (default: standard). New types will be added over time; the API rejects unknown types with a list of valid ones. - INLINECODE4 — country code (default:
DE). Currently only Germany is supported.
Output (JSON to stdout):
CODEBLOCK2
Check letter status
CODEBLOCK3
Status values: queued → printed → sent → INLINECODE9
Check remaining credits
CODEBLOCK4
List all letters
CODEBLOCK5
Local records
Every sent letter is tracked locally in {baseDir}/records/. Each file is named YYYY-MM-DD_<id-prefix>.json and contains:
CODEBLOCK6
Records are created automatically on send and updated on status. The date prefix lets agents quickly find recent letters without scanning old files. To check on pending letters, look at recent record files and call status for any that aren't sent yet.
Generating PDFs
If the user doesn't have a PDF ready, generate one:
- -
pandoc for markdown → PDF: INLINECODE17 - INLINECODE18 for HTML → PDF: INLINECODE19
- Python with
fpdf2 or reportlab for programmatic generation
Always ensure A4 format (210 × 297 mm) with at least 15 mm margins.
Error handling
Errors go to stderr with a clear origin tag. The exit code is non-zero on failure.
Origins:
- -
[local] — problem before the request (missing file, no API key) - INLINECODE23 — the API rejected the request (includes error code, HTTP status, detail, and field)
- INLINECODE24 — could not reach the API (DNS, timeout, connection refused)
Example server error:
CODEBLOCK7
On success, JSON is printed to stdout. On failure, nothing goes to stdout.
Important constraints
- - Germany only — recipient must have a German address
- Max 3 pages — longer PDFs are rejected by the server
- Max 10 MB — compress images if needed
- Black & white — images are printed in grayscale
- 1 credit = 1 letter — check credits before sending
- A4 format — ensure correct page size
- Do not validate the PDF locally — the server handles all PDF validation
Typical workflows
Kündigung (cancellation):
Ask for: service name, customer number, recipient address. Generate a formal cancellation letter as PDF, send it.
DSGVO Auskunftsersuchen (data access request):
Ask for: company name, address, user's full name. Generate a DSGVO Art. 15 request letter, send it.
Widerspruch (objection/appeal):
Ask for: authority/company, reference number, reason. Generate a formal objection letter, send it.
AgenticLetters
通过 agentic-letters.com API 向德国任意地址寄送实体信件。您的 PDF 将被打印、装入信封并邮寄——一次 API 调用,一封真实信件。
使用场景
- - 用户想要寄送实体信件、解约通知或法律文书
- 用户需要将文档(PDF)邮寄到德国地址
- 用户说寄信、Kündigung schicken、Brief versenden或类似表述
- 用户想要邮寄 DSGVO 请求、解约函、投诉信或贺卡
设置
bash
mkdir -p ~/.openclaw/secrets
echo AGENTICLETTERSAPIKEY=alyourapikey > ~/.openclaw/secrets/agentic_letters.env
获取 API 密钥
AgenticLetters 没有账户系统,也无需登录。流程如下:
- 1. 访问 https://agentic-letters.com/buy
- 输入邮箱地址并选择积分套餐
- 通过 Stripe(信用卡)支付
- API 密钥(以 al_ 开头)将立即发送至该邮箱
该密钥是每次请求中使用的 Bearer 令牌。如果用户稍后使用同一邮箱购买更多积分,现有密钥将自动充值——不会发放新密钥。如果用户尚未拥有密钥,请引导其访问 https://agentic-letters.com/buy。
工具
{baseDir}/agentic_letters.py —— 一个零依赖的 Python CLI(仅使用标准库)。
寄送信件
- 1. 生成 A4 格式 PDF(最多 3 页,最大 10 MB,黑白打印)
- 运行工具:
bash
python3 {baseDir}/agentic_letters.py send \
--pdf letter.pdf \
--name Max Mustermann \
--street Musterstraße 1 \
--zip 10115 \
--city Berlin \
--label Kündigung Fitnessstudio
可选参数:
- - --type —— 信件类型(默认值:standard)。未来将陆续添加新类型;API 会拒绝未知类型并返回有效类型列表。
- --country
—— 国家代码(默认值:DE)。目前仅支持德国。
输出(JSON 到标准输出):
json
{
id: 550e8400-e29b-41d4-a716,
status: queued,
type: standard,
label: Kündigung Fitnessstudio,
created_at: 2026-02-24T19:00:00Z,
credits_remaining: 4
}
查询信件状态
bash
python3 {baseDir}/agentic_letters.py status
状态值:queued → printed → sent → returned
查询剩余积分
bash
python3 {baseDir}/agentic_letters.py credits
列出所有信件
bash
python3 {baseDir}/agentic_letters.py list
本地记录
每封已寄送的信件都会在 {baseDir}/records/ 目录下进行本地跟踪。每个文件命名为 YYYY-MM-DD_.json,内容如下:
json
{
id: 550e8400-...,
status: queued,
type: standard,
label: Kündigung Fitnessstudio,
recipient: { name: Max Mustermann, street: Musterstraße 1, zip: 10115, city: Berlin, country: DE },
created_at: 2026-02-24T19:00:00Z,
credits_remaining: 4,
last_checked: null
}
记录在 send 时自动创建,在 status 时更新。日期前缀让代理能够快速找到近期信件,无需扫描旧文件。要检查待处理信件,请查看最近的记录文件,并对任何状态不是 sent 的信件调用 status。
生成 PDF
如果用户没有现成的 PDF,请生成一份:
- - pandoc 用于 Markdown → PDF:echo Dear Sir... | pandoc -o letter.pdf
- wkhtmltopdf 用于 HTML → PDF:wkhtmltopdf letter.html letter.pdf
- 使用 Python 的 fpdf2 或 reportlab 进行程序化生成
务必确保 A4 格式(210 × 297 mm),页边距至少 15 mm。
错误处理
错误信息会输出到标准错误,并带有清晰的来源标签。失败时退出码为非零值。
来源标签:
- - [local] —— 请求前出现问题(文件缺失、无 API 密钥)
- [server] —— API 拒绝了请求(包含错误代码、HTTP 状态码、详细信息和字段)
- [network] —— 无法连接 API(DNS 解析失败、超时、连接被拒绝)
服务器错误示例:
[server] Invalid German postal code
code: recipientzipinvalid
http_status: 400
detail: Expected a 5-digit German PLZ (e.g. 10115), got 123.
field: recipient.zip
成功时,JSON 输出到标准输出。失败时,标准输出无任何内容。
重要限制
- - 仅限德国 —— 收件人必须拥有德国地址
- 最多 3 页 —— 更长的 PDF 会被服务器拒绝
- 最大 10 MB —— 如有需要请压缩图片
- 黑白打印 —— 图片将以灰度打印
- 1 积分 = 1 封信 —— 寄送前请检查积分余额
- A4 格式 —— 确保页面尺寸正确
- 请勿在本地验证 PDF —— 所有 PDF 验证由服务器处理
典型工作流程
解约函(Kündigung):
询问:服务名称、客户编号、收件人地址。生成正式解约函 PDF 并寄送。
DSGVO 数据查询请求(DSGVO Auskunftsersuchen):
询问:公司名称、地址、用户全名。生成 DSGVO 第 15 条请求函并寄送。
异议/申诉(Widerspruch):
询问:机构/公司名称、参考编号、理由。生成正式异议函并寄送。