sandtable-ai package is also a library. The CLI is built on it, so anything a command does, your code can do: run a suite inside your own test runner, write an agent adapter for a framework, regrade stored trials, or compare two runs.
Domains
The spec’s shapes are TypeScript types:
Domain, Tool, Op, Invariant, Task, StateAssert, CallExpect, ReferenceCall, FieldRefSpec, Persona and Given. The spec reference describes every key.
The world and its tools
For an agent that runs its own tool loop, or a test of a tool’s behavior.Agents and simulated users
An agent is anAgentAdapter: a name, and createSession(ctx) that returns a session whose reply(userMessage, callTool) returns the agent’s reply. ctx carries the domain, the default system prompt (system), the tools as ToolSchema[], a sessionId, the task’s context, and recordUsage to report tokens. A simulated user is a UserSimulator, whose session’s next(agentMessage) returns { text, stop }. These types, with CallTool, AgentContext, AgentSession, UserContext, UserSession and UserTurn, are exported. Bring your agent shows complete adapters.
Running, regrading and comparing
The result types are exported too:
SuiteResult, TaskSummary, TrialResult, TrajectoryEvent, CheckResult, Violation, Verdict, Comparison, Attribution, TokenUsage and the rest. The results.json reference describes every field.
Reports
Example: a suite in your test runner
user.script. For conversations, pass claudeUser() or openaiCompatUser(...), which call a model.