Skip to main content
Test mode

Ship a working test agent against thehosted backend in ten minutes.

A test key, a declared mocks payload, and a single session.send(). Policy, audit, and commerce-memory all fire on the same code path live traffic uses — so the agent you ship here is the agent you ship to production.

Three things test mode guarantees

Deterministic input. Real governance. One agent that flips to live.

01

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.

02

Policy, audit, and commerce-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 commerce-memory rows surface against deterministic input — before a single real cent moves.

03

The same agent code flips to live, unchanged

Drop the mocks payload, point a live-environment key at the same session shape, and the agent runs against real providers. No environment branching in your code, no second integration to maintain.

The shape, before the quickstart

One session. One mock. One assertion.

Abbreviated for shape — the full walkthrough with TS + Python parity lives in the quickstart. The mock you declare at create time is the value your agent gets back when the LLM calls the tool.

test-agent/session.ts
1import { codespar } from "@codespar/sdk";
2 
3// One session, one declared mock, one assertion.
4const session = await codespar.create("user_test", {
5 servers: ["asaas"],
6 mocks: {
7 "asaas/create_payment": { id: "pay_test_42", status: "PENDING" },
8 },
9});
10 
11const result = await session.send(
12 "Charge R$ 42 via Pix on Asaas"
13);
14 
15// result.tool_calls[0].response.id === "pay_test_42"

Same shape, same canonical tool name as a live call. Drop the mocks payload to ship.

After the first ten minutes

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.

Project flip is one toggle

A project carries an immutable environment field. Create a test project for the walkthrough, mint a csk_test_* key into it on signup, and the same agent code runs unchanged when you point a csk_live_* key at a live-environment project.

Ten minutes.One working agent.

Get a test key, walk the quickstart, watch the audit chain land against your declared mocks.