1. Wrap a labelled local fixture
Install the published package from Quickstart, then run the validated ts/py examples below. The synthetic examples assert result identity and a deliberate bypass. They never contact a vendor or execute a live write.
2. First evidence
The healthy default engine reports no drift because no detector was selected. The explicit loading-fault or closed-engine fixture produces one bypass event. Read recent metadata without treating either result as proof that an API is safe.
3. Audit artifact
The second validated snippet’s TypeScript tab configures an audit tenant and capacity, runs a synthetic read, and drains the actual WASM artifact into a labelled in-memory sink. The Python tab retains identity and local events; guest audit FIFO drain remains Node-only. Production hosts must persist before acknowledging delivery. This fixture has no hosted retrieval URL; a full or lost queue cannot establish durable delivery.
4. Optional review
A review case requires admitted strict-policy evidence and an explicitly configured host review port. This example does not create one. A reviewer receipt describes a human decision; it does not execute a write or release a terminal idempotency key. Production review delivery remains unavailable.
Continue
Keep configuration, call decisions and evidence separate.
import { createAgindow } from 'agindow';
const sdk = createAgindow({ mode: 'observe' });
await sdk.ready;
const payload = { id: 'synthetic-customer' };
let calls = 0;
const read = sdk.guard(() => { calls++; return payload; }, { tool: 'vendor.read', operation: 'read' });
const result = read();
if (result !== payload || calls !== 1) throw Error('Fixture identity changed');
// A labelled unavailable-engine fixture produces one bypass without a hosted key.
const unavailable = createAgindow({ mode: 'observe' }, async () => { throw Error('Synthetic loading fault'); });
await unavailable.ready;
const fallback = unavailable.wrap(() => payload);
if (fallback() !== payload || unavailable.recent().filter(e => e.type === 'bypass').length !== 1) throw Error('Missing bypass');
sdk.configure({ mode: 'observe' });
console.log('Synthetic fixture: original result retained; unavailable engine bypassed once.');import asyncio
from agindow import Agindow
sdk = Agindow(mode="observe")
payload = {"id": "synthetic-customer"}
@sdk.guard(tool="vendor.read", operation="read")
def read() -> dict[str, str]:
return payload
@sdk.guard(tool="vendor.read", operation="read")
async def read_async() -> dict[str, str]:
return payload
with sdk.context(mode="observe"):
assert read() is payload
async def main() -> None:
async with sdk.context(mode="observe"):
assert await read_async() is payload
asyncio.run(main())
# A closed engine is a labelled availability fixture, not vendor drift.
sdk.close()
assert read() is payload
assert len([event for event in sdk.recent() if event.type == "bypass"]) == 1
print("Synthetic fixture: sync/async identity retained; closed engine bypassed once.")import { createAgindow } from 'agindow';
import type { AuditRecord } from 'agindow';
const sdk = createAgindow({ mode: 'observe', audit: { tenant: 'synthetic', capacity: 4 } });
await sdk.ready;
const payload = { id: 'synthetic-customer' };
const result = sdk.guard(() => payload, { tool: 'vendor.read', operation: 'read' })();
if (result !== payload) throw Error('Observe changed the payload');
// Synthetic, in-memory sink only. A real host must persist before acknowledging.
const artifacts: AuditRecord[] = [];
const receipt = await sdk.drainAudit(artifact => { artifacts.push(artifact); });
if (!receipt.available || receipt.delivered !== 1 || artifacts[0]?.['decision'] !== 'ok') throw Error('Missing audit evidence');
console.log('Synthetic audit receipt', receipt, artifacts[0]?.id);# Guest audit FIFO drain (Node sdk.drainAudit) is not published on Python.
# This fixture still proves observe identity and retained local events.
from agindow import Agindow
sdk = Agindow(mode="observe")
payload = {"id": "synthetic-customer"}
@sdk.guard(tool="vendor.read", operation="read")
def read() -> dict[str, str]:
return payload
result = read()
if result is not payload:
raise AssertionError("Observe changed the payload")
print("Synthetic fixture: Python retains identity; guest audit drain remains Node-only.")