Six Reliability Primitives for LLM Agents: An Artifact Pattern for Stackable, Single-Concern Libraries
Description
Reliability concerns for large-language-model agents are typically addressed inside frameworks that bundle prompting, tool routing, and runtime governance into a single dependency. This paper presents the agent-stack: a set of six small, single-concern reliability libraries published independently to npm, PyPI, and the Model Context Protocol registry. The libraries are AgentFit (context-window fitting), AgentGuard (network egress allowlist), AgentSnap (snapshot tests for tool-call traces), AgentVet (validate tool arguments before execution), AgentCast (structured-output enforcer), and AgentBudget (token and dollar caps). Each library is zero-dependency, has a TypeScript implementation with hand-maintained type declarations, a Python port with the same surface, and an MCP-server variant. Repository inspection across the eighteen public packages identifies a recurring artifact pattern: a single class or function as the public surface, a typed error carrying retry-friendly context, and an opt-in automatic adapter for popular provider response shapes. The contribution is a documented design pattern for reliability primitives that compose by inclusion rather than by framework lock-in. The paper describes the primitives, the cross-cutting invariants the design enforces, the trade-offs of single-concern packaging, and the operational questions that emerge when reliability is split across many small dependencies.
Files
agent-stack-reliability-primitives-preprint.pdf
Files
(18.5 kB)
| Name | Size | Download all |
|---|---|---|
|
md5:9e7162236afe1beb03515b5c92c0ca67
|
18.5 kB | Preview Download |