Skip to main content
Use the separate @agentium/harness/testing entrypoint to verify the runtime contract of a custom driver. Prefer deterministic fixtures before testing a real provider or external effect.

Run the driver contract fixture

Save as driver-contract.ts and run npx tsx driver-contract.ts after the quickstart installation.
The helper returns { result, eventCount } and checks ordered event sequences, run identity, schema version, exactly one terminal event, terminal/result agreement, final cursor, observer completion, and stable results after late cancellation. It rejects a failed result and closes fixture session resources. Its optional second argument is Omit<HarnessRuntimeConfig, "driver">; the default grants no tools and the main model role. The helper executes the supplied driver with a conformance input. A real driver may call a provider or perform effects, so choose its test configuration deliberately. Passing the fixture does not prove that custom code never bypasses controlled services.

Troubleshoot common failures

Handle synchronous configuration errors separately from a run’s result.reason. Do not import internal validation classes from private package paths; HarnessValidationError is not a root package export. Inspect thrown errors and their diagnostics where present.

Validate your integration

Exercise one successful run, a denied tool, budget exhaustion, cancellation, a session conflict, observer reconnection, and cleanup failure handling using deterministic clients. For watches, verify cursor/digest persistence and uncertain-send reconciliation with your store and connector implementations. Do not infer live provider guarantees from an in-memory fixture. See testing helper signature, runtime options, and watch state types.