Expand description
The state store contract and adapters (RFC 0025 §2, §4).
agentd’s durability rests on four operations against a REMOTE store —
put(key, seq, envelope) / get(key[, seq]) / list(prefix) / delete(key) —
implemented by an adapter chosen in store.kind: mcp (any MCP server’s
tools, mapped), http (plain HTTP), or memory (in-process; tests and
dev). put is a compare-and-set on seq: the stored seq must be lower,
else Conflict — the split-brain guard every caller treats as fatal.
agentd links no database client and defines no schema beyond the
Envelope.
Modules§
- http
- The HTTP store (RFC 0025 §4.2): the four operations as plain HTTP
requests built from
store.http.{get,put,list,delete}templates —GET/PUT/POST/DELETE {url}with an optional JSONbody, extraction frombody/status/headers. HTTPS (loopbackhttp://for dev), headers may carry{{secret:…}}references (resolved at dial time, never logged), the idempotency key rides asIdempotency-Key;conflict_status(default409) maps toConflict,404on a read to absent. - mapping
- The mapping language the store adapters and the tool overrides share (RFC 0025 §4, RFC 0028 §4): render an argument object / URL / body from a template over named inputs, and extract a value from a result.
- mcp
- The MCP-mapped store (RFC 0025 §4.1): the four store operations are
tools/calls against a declared MCP server, with argument templates and result extraction fromstore.mcp.{put,get,list,delete}. The default mapping is the RFC 0021 §8.3 checkpointer profile (state.put/get/list,state.delete), so a server advertising those tools needs no mapping. - memory
- The in-process store (RFC 0025 §4.3) —
store.kind: memory. Keeps per-key history (soget(key, seq)works like a history-keeping server), enforces the seq CAS, supportslist/delete, and offers fault injection for tests: fail the next N operations, add latency, or refuse a specific key. Not durable across the process (dev/test only — the loader warns).
Structs§
- Envelope
- A versioned store record:
stateis the kind-specific payload; a tombstone carriesstate: null. - KeySeq
- A
listentry.
Enums§
- PutOutcome
- The outcome of a
put. - Store
Error
Constants§
- ENVELOPE_
VERSION - The envelope major this build writes and accepts (RFC 0025 §3.2).
Traits§
- Store
- The four-operation contract (RFC 0025 §2). Implementations are
Send + Syncso the runtime’s executor pool can call them; every operation is bounded by the adapter’s timeout.
Functions§
- default_
timeout - The store timeout class: the management timeout (RFC 0016 §10) unless the settings say otherwise.
- key
<prefix>/<instance>/<kind>/<id>(RFC 0025 §3.1).- open
- Build the store an instance is configured with (RFC 0030 §3.5).
serversresolves themcpadapter’s coordination server by name;kind: noneyields no store (the caller decides whether that is allowed). - parse_
key - Split a key produced by
keyback into(kind, id)for the given prefix/instance;Nonefor a foreign key. - with_
retry - Bounded retry on
Ioerrors (never onConflict/Mapping/Corrupt).
Type Aliases§
- Shared
Store - A shared store handle.