metalworks.PROTOCOLS_VERSION); minor versions add keyword-only parameters
with defaults, major versions break. Adapters declare which version they
implement, and the conformance suites in metalworks.testing are the contract.
ChatModel
thinking_budget is in tokens; adapters map it to their provider’s mechanism.
Dispatch on capabilities.native_grounding, never isinstance.
GroundedChatModel
GroundedResult carries text, chunks: tuple[GroundingChunk, ...], and
supports: tuple[GroundingSupport, ...]. Support spans are character
offsets into text (adapters convert provider byte offsets), so finding-to-
citation overlap bucketing is correct for non-ASCII output.
SearchProvider
GroundedChatModel. The research web stream prefers internal
grounding and falls back to an external SearchProvider + structured synthesis.
EmbeddingProvider
IndexIdentity (model id + dim) and
hard-fails with EmbeddingModelMismatch on a mismatch. Vectors from different
models are geometrically incompatible; same-dimension swaps degrade retrieval
silently, so the guard is a hard error, not a warning.
Storage repos
Typed repositories, not a generic document store (production tables are columnar). One backend object implements as many as it supports.BriefRepo, RunRepo, AccountRepo, OpportunityRepo, and InboxRepo follow
the same shape. Backends: MemoryStores, SqliteStores (WAL, serialized
writer), SupabaseStores (paginate-to-exhaustion). Verify a custom backend
with metalworks.testing.check_all_repos.
Errors
Every error carries an actionablefix and a machine-readable envelope used by
the MCP tools: