Skip to main content
The 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.
The package is an ES module. Its TypeScript types ship with it. The exports below are the whole API: anything not listed here is internal and can change in any release. From 1.0, adding an export comes in a minor release, and removing or renaming one only in a major release.

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 an AgentAdapter: 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

A scripted user needs each task’s user.script. For conversations, pass claudeUser() or openaiCompatUser(...), which call a model.