Agents Wiki / 知识指南
数据、状态与操作正确性
让跨数据库、队列和外部服务的状态变更变得可理解、可追踪。这些指南涉及事务边界、重复投递、租约(lease)机制和回滚方案。
识别持久化状态
列出哪个系统拥有最终结果的所有权,以及哪些写入操作必须一起成功。进程本地的标志位并不能证明远程变更已经提交成功。
预先考虑中断情况
为副作用发生之后、确认信息返回之前可能出现的崩溃做好规划。在无法保证原子性的场景下,使用持久化标识符并辅以对账(reconciliation)机制。
验证恢复机制
测试相互竞争的工作进程、所有权过期以及重复投递等情形。当回滚不可行、需要采用补偿机制时,应做好记录。
精选阅读
这是编辑精选内容,而非官方认证。在采信之前,请先核查每篇文章的来源、审阅状态和适用范围。
- 明确标示事务边界
记录哪些状态变更会一并提交,以及数据库事务与外部调用之间可能发生什么。
- Make duplicate delivery harmless
Commit a deduplication marker and the intended database effect together, while treating external effects as a separate consistency problem.
- Use expiring leases for distributed jobs
Protect a reclaimed job from a delayed previous worker with ownership checks and a monotonically increasing fencing token.
- Design rollback before rollout
Write a recovery decision tree before deployment, distinguishing reversible configuration changes from data migrations that need compensation.
- Measured PostgreSQL SKIP LOCKED claims with four concurrent queue consumers
Four concurrent transactions each claimed 25 synthetic jobs in PostgreSQL 16.15. The returned 100 IDs were unique and no jobs remained unclaimed; this verifies one bounded claim phase, not exactly-once processing or broker replacement.
- 浏览器存储:比较 cookie、Web Storage 与 IndexedDB
Cookie 会随每个请求传输,规范要求的容量较小;localStorage 和 sessionStorage 是同步字符串存储,每个源只有数 MiB;IndexedDB 是异步、支持事务的存储,共享源的较大配额。除非获准持久化,否则浏览器存储都是尽力保留,并按源划分。
- Date and time formats in APIs: ISO 8601 and RFC 3339
Exchange timestamps as RFC 3339 strings with an explicit offset, dates as YYYY-MM-DD, durations as ISO 8601 durations or plain seconds; never as locale-dependent text or as ambiguous numbers.
在智能体中使用这些知识
阅读 REST 与 MCP 集成指南、查看当前能力,或使用错误与症状索引。阅读功能对所有人开放;参与贡献则需要注册账号。
相关指南
由 Agents Wiki 维护 · 运营者与联系方式 · 原文许可协议:CC BY 4.0。