Protected_Metadata provider used by the driver for entity access. Set explicitly via the
Provider setter; falls back to the global Metadata.Provider when not set.
The engine (or test harness) should set this to thread a transaction-scoped provider.
Protected_The metadata provider this driver uses. Falls back to the global Metadata.Provider
when the engine hasn't injected an explicit provider — multi-tenant servers should
always set this so each driver run binds to the right database connection.
ProtectedcalculateProtectedCalculate overall score from oracle results.
If weights are provided, calculates weighted average. Otherwise, calculates simple average.
Results from oracle evaluations
Optionalweights: ScoringWeightsOptional scoring weights by oracle type
Overall score from 0.0 to 1.0
ProtectedcreateProtectedCreate a log message for the test execution log.
Log level
Log message
Optionalmetadata: Record<string, unknown>Optional metadata
TestLogMessage object
ProtectedCreateThe runner for one call: failover as the prompt configures it, or none. Overridable, so a test can supply a fake runner.
Whether the runner may fail over.
ProtecteddetermineProtectedDetermine overall test status from oracle results.
Test passes only if ALL oracles pass.
Results from oracle evaluations
'Passed' if all oracles passed, 'Failed' otherwise
Execute the test.
This is the main entry point for test execution. The driver should:
The base engine will handle:
Execution context including test, run, user, options
Promise resolving to execution result
ProtectedgetProtectedGet the effective timeout for a test.
Priority (highest to lowest):
The test entity
Optionalconfig: { maxExecutionTime?: number }Parsed configuration object (optional)
Timeout in milliseconds
ProtectedLoadLoads what one discovery run needs, the way production's discovery loads it: AIEngine, the
decision prompt by name (not for a baseline cell, which makes no call), the conversation
manager, the agents the run's user may run, the prompt's option cap, and the semantic search
when the provider can run it. Throws when the prompt or the conversation manager is missing.
Overridable, so a test can run the driver without an engine or a provider.
Optionalbaseline?: "semantic-search" | nullRuns this baseline instead of the decision: no decision call is made.
Optionalfailover?: boolean | nullWhether the runner may fail over. Defaults to false when the cell pins a model or vendor.
OptionalmodelId?: string | nullPins the MJ: AI Models row that must answer.
The oracles to run.
OptionalpromptName?: string | nullThe decision prompt. Defaults to Default Decision, the prompt production's discovery asks.
Optionalseed?: number | nullRequested sampling seed. Recorded, not applied: see the driver.
Optionaltemperature?: number | nullRequested sampling temperature. Recorded, not applied: see the driver.
OptionalvendorId?: string | nullPins the vendor.
ProtectedLoadLoads what one run needs: AIEngine, the decision prompt by name, the agent catalog and the
conversation manager. Throws when the prompt is missing. Overridable, so a test can run the
driver without an engine.
Which decision builder. A discovery test has its own schema (DiscoveryEvalConfigSchema).
Optionalfailover?: boolean | nullWhether the runner may fail over. Defaults to false when the cell pins a model or vendor.
OptionalmodelId?: string | nullPins the MJ: AI Models row that must answer.
The oracles to run.
OptionalpromptName?: string | nullThe decision prompt. Defaults to DEFAULT_DECISION_PROMPT_NAME.
Optionalseed?: number | nullRequested sampling seed. Recorded; see the driver for whether it reaches the model.
production sends BuildRoutingState; structured sends BuildRoutingStateStructured.
Optionaltemperature?: number | nullRequested sampling temperature. Recorded; see the driver for whether it reaches the model.
OptionalvendorId?: string | nullPins the vendor.
ProtectedlogProtectedLog execution progress.
Log message
Whether to only log in verbose mode (default: false)
ProtectedlogProtectedLog errors.
Error message
Optionalerror: ErrorOptional error object
ProtectedlogProtectedLog a message to both the console (if verbose) and accumulate for test run log.
Driver execution context
Log level
Log message
Optionalmetadata: Record<string, unknown>Optional metadata
ProtectedparseProtectedParse and validate Configuration JSON.
Helper method for drivers to parse their configuration with type safety. Throws if configuration is invalid.
The configuration type
The test containing the configuration
Parsed configuration
ProtectedparseProtectedParse and validate ExpectedOutcomes JSON.
The expected outcomes type
The test containing the expected outcomes
Parsed expected outcomes
ProtectedparseProtectedParse and validate InputDefinition JSON.
The input definition type
The test containing the input definition
Parsed input definition
Suite-scoped setup. Runs ONCE after the suite run is created and before the
first test's Execute, when the test runs inside a suite (mj test suite).
Provision suite-shared fixtures here — discover/create users, create
Query/Category rows, refresh engine caches — and stash them on
context.Data / context.CreatedRecords so every Execute of the suite
(which receives this same context via DriverExecutionContext.fixtures) can
read them, and TeardownSuite can clean them up.
Default is a no-op, so existing drivers (AgentEval, Computer Use) are
unaffected. Does NOT fire for the standalone mj test run path (no suite).
Per-suite-run fixture bag, keyed by SuiteRunID
User context for data access
Whether this driver supports cancellation via AbortSignal.
Drivers should override this to return true if they properly handle cancellation tokens. When a driver doesn't support cancellation, timeout will still mark the test as failed but the underlying execution may continue in the background.
true if driver supports cancellation, false otherwise
Suite-scoped teardown. GUARANTEED by TestEngine.RunSuite via a finally, so
it runs on pass, fail, a thrown Execute, and after a 'Timeout' result.
MUST be best-effort: never throw (the engine logs and ignores any throw),
only clean up. Delete what SetupSuite created (the context.CreatedRecords
list and any driver-specific payload under context.Data).
Default is a no-op. Does NOT fire for the standalone mj test run path.
The same per-suite-run fixture bag passed to SetupSuite
User context for data access
Validate test configuration.
Called when creating or updating a test to ensure the configuration is valid for this test type. Override to add type-specific validation.
The test being validated
Validation result with errors and warnings
Runs ONE typed decision on a corpus point and scores it against the point's label.
The point is mapped to the routing decision's input, and the questions and state are built, with the same builders the chat uses (
@memberjunction/ai-core-plus), so the eval sends exactly what production sends. OneAIDecisionRunner.ExecuteDecisionanswers it, and the oracles score the answer. The prompt run is linked as the test run's target, so cost comes from it.Pinning. A cell that names
modelIdand/orvendorIdpins them through the runner's own mechanism,AIDecisionParams.override, and runs with failover off (PinnedDecisionRunner) unless the cell setsfailover: true. The model that answered is recorded; a pinned run answered by another model or vendor is flagged, and when failover was off it is anError, not a data point.Sampling.
temperatureandseedare recorded but do not reach the model: the decision path has no parameter for them (see SAMPLING_NOT_APPLIED).Agent discovery. A test whose
Configuration.decisionisagent-discoveryasks production's discovery decision instead (plan Task 3.1): the options come fromBuildDecisionDiscoveryOptionSetover the agents the run's user may run, with the real semantic search, and the questions fromBuildDecisionDiscoveryQuestions, both from@memberjunction/ai-agents, the codeBaseAgentruns. Production gives up after DECISION_DISCOVERY_TIMEOUT_MS, counted from building the options, so the driver times the same span and records an answer that came later as not injected. The call itself runs to the end, so the late answer is still recorded. Asemantic-searchbaseline cell makes no decision call: it records whatFind Candidate Agentswould have listed first.Never throws. A bad test, a missing prompt and a failed decision come back as an
Errorrun with the reason. A point or request with nothing to decide isSkipped: production makes no call there.