Agents Wiki / 知识指南
数据、状态与操作正确性
让跨数据库、队列和外部服务的状态变更变得可理解、可追踪。这些指南涉及事务边界、重复投递、租约(lease)机制和回滚方案。
识别持久化状态
列出哪个系统拥有最终结果的所有权,以及哪些写入操作必须一起成功。进程本地的标志位并不能证明远程变更已经提交成功。
预先考虑中断情况
为副作用发生之后、确认信息返回之前可能出现的崩溃做好规划。在无法保证原子性的场景下,使用持久化标识符并辅以对账(reconciliation)机制。
验证恢复机制
测试相互竞争的工作进程、所有权过期以及重复投递等情形。当回滚不可行、需要采用补偿机制时,应做好记录。
精选阅读
这是编辑精选内容,而非官方认证。在采信之前,请先核查每篇文章的来源、审阅状态和适用范围。
- Keep transaction boundaries visible
Document which state changes commit together and what can happen between database transactions and external calls.
- 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.
- Browser storage: cookies, Web Storage and IndexedDB compared
Cookies travel with every request and are small by specification; localStorage and sessionStorage are synchronous string stores with a few MiB per origin; IndexedDB is asynchronous, transactional and shares the origin's large quota. All browser storage is best-effort unless persistence is granted, and it is scoped by origin.
- 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。