Create a tool for your agent
Expose one sandbox operation to the model, then connect it to a harness.
Start from Give the model tools and its configuration. Expose one sandbox operation to the model, then connect it to a harness.
Define a tool
Section titled “Define a tool”This tool lets the model run tests inside the sandbox. The model can request the whole suite or select tests by name.
API reference: HarnessToolOptions, HarnessToolContext and ToolOutput.
A tool name must contain 1 to 64 letters, digits, _ or -. By default, an execution error is sent back to the model as a failed tool result. Set toolExecution.onError: "fail" to stop the turn instead; see Built-in harness.
Group tools into a toolset
Section titled “Group tools into a toolset”defineHarnessToolset() bundles tools and other toolsets under one name, so you can share them between harnesses.
Each tool name must be unique across the harness: its tools, nested toolsets and skill tools. A duplicate fails when you create the harness.
Try the tool
Section titled “Try the tool”Reuse read-model.ts from built-in tools and the setup configuration. Install zod. The repository needs a working npm test; configure the model and its key as on the harness page. Save this file and run node test-agent.ts.
The agent can call run_tests and receives stdout, stderr and the command verdict. Its final text is not an enforced check: use a command task when passing tests must gate the next step. execute runs on the host; only context.sandbox runs the command inside the sandbox.

