Testing
Test your app with the fake harness, the local sandbox and the memory store, and run byoa's own tests.
Test your app without a plan or a sandbox
Use harness: 'fake', localSandbox() from @madeyexz/byoa/sandbox/local and memoryStore() from @madeyexz/byoa. The fake harness runs no model and needs no login. It reads the same MCP config Claude Code would, and calls MCP tools through the real proxy: each task line call <server>.<tool> <json> is one call. So a test proves your app's routes, grants and proxy end to end.
import { createAgents, memoryStore } from '@madeyexz/byoa'
import { localSandbox } from '@madeyexz/byoa/sandbox/local'
// serve agents.proxy at http://127.0.0.1:3000/byoa/mcp, as in Getting started
const agents = createAgents({
app: 'myapp-test', sandbox: localSandbox(), store: memoryStore(), encryptionKey,
proxyUrl: 'http://127.0.0.1:3000/byoa/mcp', oauth: { redirectUrl: 'http://127.0.0.1:3000/byoa/callback' },
tools: { todos: todoTools },
})
for await (const ev of agents.run('u1', { harness: 'fake', task: 'call todos.add_todo {"title":"milk"}', mcp: ['todos'] })) {
if (ev.type === 'end') assert.ok(ev.ok)
}- The fake harness shows the task's first line as one
textevent and skips the other lines. The last call's output is theendevent'sresult. - In a
conversation, the fake harness keeps each task in a session file and says how many earlier messages it remembers (fake harness remembers 1 earlier messages: <first line>), so you test your app's conversations with no model. - With the local sandbox,
proxyUrlcan behttp://127.0.0.1:<port>/byoa/mcp. - Copy examples/todo/todo.test.ts. Do not offer
faketo end users in production.
Test byoa itself
npm testruns V10, V12, the fake-harness tests and the unit tests.npm run test:v11runs V11; it downloads about 600 MB. CI runs both on every commit.npm testnever starts a paid sandbox, also when the providers' keys are set: each paid check needs its own flag.npm run test:daytonachecks the Daytona adapter against Daytona and runs V8 there. It needsDAYTONA_API_KEY, and withBYOA_DAYTONA_VOLUMES=1also checks its volumes; that needs a key with the volume permissions.npm run test:v4runs V4 (test/v4.test.ts) withE2B_API_KEYandDAYTONA_API_KEY; it needscloudflaredto give the proxy a public URL. On a Daytona org on Tier 1 or 2, also setBYOA_V4_RELAYto a relay on an allowed domain, such as test/relay deployed to a temporary Convex project.npm run test:e2bchecks the E2B adapter against E2B and runs V8 there (a user's jobs in one paused and resumed sandbox, andsandboxPer: 'job'). It needsE2B_API_KEY, and withBYOA_E2B_VOLUMES=1also checks volumes, for an E2B team with volumes turned on.npm run test:instaboxdoes the same on Instabox. It needsINSTABOX_API_KEY.BYOA_V4_PROVIDERS=e2b,instaboxruns V4 on E2B and Instabox.Each of these adapter tests first runs the conformance check, test/helpers/conformance.ts;
npm testruns it on the local sandbox.node scripts/v21.tsruns V21 (conversations and steering with real logins on E2B) in steps, because a person signs in:login claude|codex|grok, thencheck, thencleanup, which signs out and deletes the sandboxes. It needsE2B_API_KEY.spec/tla/check.shruns V22: TLC checks the TLA+ models of the job lifecycle, the login lease, the sign-in and the store indexes (spec/tla). It needs Java 11 or later, and downloads TLC the first time. CI runs it when the models or the code they model change.
The checks V1 to V22 are in SPEC.md.