Run a test agent against thehosted backend, with mocks you declare.
A test key (csk_test_), Node 20 or later, a declared mocks payload and one session.send(). A mocked tool call returns the value you pinned and never reaches the provider; policy, audit and per-tenant memory run on the same code path live traffic uses.
Deterministic input. Real governance. One code path to live.
Deterministic responses, no provider OAuth
Declare a mock per tool call once at session creation; every matching call returns the value you pinned. Static objects or stateful arrays: same shape, same canonical tool name as a live call. No sandbox keys to rotate, no provider consent flows to script around in tests.
Policy, audit and memory fire on every send
The same governance hooks that run in live traffic evaluate on every session.send() in test mode. Tune approval rules, verify audit-chain shape, and watch memory rows surface against deterministic input, before a single real cent moves.
The same session code runs live
Drop the mocks payload and use a key from a live project: the code does not change, but live needs what live needs: KYC/KYB on the account and a connection for each provider the agent calls. A mock is not the provider's sandbox; testing against a provider sandbox is its own step.
One session. One mock. One assertion.
Abbreviated for shape; the quickstart has the full walkthrough in TypeScript and Python. The mock you declare at create time is what the tool call returns when the model calls that tool. The provider is not called.
1import { CodeSpar } from "@codespar/sdk";2 3// Prerequisites: CODESPAR_API_KEY=csk_test_... in the environment.4// One session, one declared mock, one assertion.5const session = await new CodeSpar().create("user_test", {6 servers: ["asaas"],7 mocks: {8 "asaas/create_payment": { id: "pay_test_42", status: "PENDING" },9 },10});11 12const result = await session.send(13 "Charge R$ 42 via Pix on Asaas"14);15 16// result.tool_calls[0].output is the declared mock:17// { id: "pay_test_42", status: "PENDING" }18console.log(result.tool_calls[0]?.output);Same canonical tool name as a live call. To reach the real provider, drop the mocks payload and use a live project's key.
The shape that holds up past the first send.
Mocks have shapes
Pin a static object for one-call tests, a stateful array for sequence tests (each call drains an entry, then the cap kicks in). Both shapes live in the same mocks payload at session creation; both go through the same canonical-tool-name validator the live providers do.
Audit chain works the same way
Test-mode tool calls emit the same tool_call.succeeded and tool_call.failed events as live traffic. The audit page filters scope by environment, so you can review a test session's events without scrolling through production noise.
Test and live are separate projects
A project's environment is fixed when it is created: a test project takes csk_test_* keys, a live project csk_live_* keys. Moving to live means a live project, KYC/KYB on the account and the provider connections the agent uses; the session code stays the same.
One test key.One mocked session.
Get a test key, run the quickstart, and read the audit events your mocked calls produce.