Skip to content

@memberjunction/ng-ai-test-harness

A comprehensive Angular component for testing AI agents, prompts, and actions in MemberJunction applications. Supports embedded, dialog, and floating window presentation modes with real-time streaming, execution monitoring, and window management.

The AI Test Harness provides a multi-mode testing interface for MemberJunction’s AI capabilities. It supports three testing modes (Agent, Prompt, Action), multiple presentation contexts (embedded component, dialog, floating window), and includes specialized components for monitoring agent execution trees and viewing JSON results.

graph TD
    A[AITestHarnessModule] --> B[Core Components]
    A --> C[Window Components]
    A --> D[Services]

    B --> B1[AITestHarnessComponent]
    B --> B2[AITestHarnessDialogComponent]
    B --> B3[AgentExecutionMonitorComponent]
    B --> B4[AgentExecutionNodeComponent]
    B --> B5[JsonViewerWindowComponent]

    C --> C1[AITestHarnessWindowComponent]
    C --> C2[TestHarnessCustomWindowComponent]

    D --> D1[AITestHarnessDialogService]
    D --> D2[TestHarnessWindowService]
    D --> D3[TestHarnessWindowManagerService]
    D --> D4[WindowDockService]

    B1 --> E["Testing Modes:
    Agent | Prompt | Action"]

    style A fill:#2d6a9f,stroke:#1a4971,color:#fff
    style B fill:#7c5295,stroke:#563a6b,color:#fff
    style C fill:#2d8659,stroke:#1a5c3a,color:#fff
    style D fill:#b8762f,stroke:#8a5722,color:#fff
Terminal window
npm install @memberjunction/ng-ai-test-harness
import { AITestHarnessModule } from '@memberjunction/ng-ai-test-harness';
@NgModule({
imports: [AITestHarnessModule]
})
export class YourModule { }
<mj-ai-test-harness
[config]="testConfig"
[embedded]="true"
(executionComplete)="onTestComplete($event)"
(modeChanged)="onModeChanged($event)">
</mj-ai-test-harness>
testConfig: TestHarnessConfig = {
mode: 'agent',
entityId: 'agent-id-here',
showHistory: true,
showAdvancedOptions: false,
theme: 'light',
maxHistoryItems: 10
};
import { AITestHarnessDialogService } from '@memberjunction/ng-ai-test-harness';
constructor(private testHarness: AITestHarnessDialogService) {}
// Test an agent
testAgent() {
this.testHarness.openForAgent('agent-id').subscribe(result => {
if (result.success) {
console.log('Agent test successful:', result);
}
});
}
// Test a prompt
testPrompt() {
this.testHarness.openForPrompt('prompt-id').subscribe(result => {
console.log('Prompt test result:', result);
});
}
// Test an action
testAction() {
this.testHarness.openForAction('action-id').subscribe(result => {
console.log('Action test result:', result);
});
}
import { TestHarnessWindowService } from '@memberjunction/ng-ai-test-harness';
constructor(private windowService: TestHarnessWindowService) {}
openInWindow() {
this.windowService.open({
mode: 'agent',
entityId: 'agent-id'
});
}

Visualize agent execution as a tree of steps:

<mj-agent-execution-monitor
[agentRunId]="runId"
[autoRefresh]="true">
</mj-agent-execution-monitor>

Display JSON data in a formatted, scrollable window:

<mj-json-viewer-window
[data]="jsonData"
[title]="'Execution Result'">
</mj-json-viewer-window>
PropertyTypeDefaultDescription
mode'agent' | 'prompt' | 'action''agent'Testing mode
entityIdstring-Pre-selected entity ID
showHistorybooleantrueShow execution history
showAdvancedOptionsbooleanfalseShow advanced settings
theme'light' | 'dark''light'Visual theme
maxHistoryItemsnumber10Max history items to display

The test harness supports real-time streaming for compatible AI models:

this.testHarness.open({
mode: 'prompt',
streamResponse: true,
temperature: 0.7,
maxTokens: 2000
});

The TestHarnessWindowManagerService coordinates multiple floating test windows with docking support via WindowDockService.

:root {
--harness-primary: #007bff;
--harness-success: #28a745;
--harness-error: #dc3545;
--harness-background: #f8f9fa;
--harness-text: #212529;
}
PackageDescription
@memberjunction/aiAI abstraction layer
@memberjunction/ai-core-plusAI core plus functionality
@memberjunction/ai-engine-baseAI engine base classes
@memberjunction/coreCore framework
@memberjunction/core-entitiesEntity type definitions
@memberjunction/globalGlobal utilities
@memberjunction/graphql-dataproviderGraphQL data access
@memberjunction/ng-code-editorCode editor component
@memberjunction/ng-container-directivesLayout directives
@memberjunction/ng-notificationsNotification system
@memberjunction/ng-sharedShared Angular utilities
@memberjunction/ng-shared-genericShared generic components
@progress/kendo-angular-*Kendo UI components
  • @angular/common ^21.x
  • @angular/core ^21.x
  • @angular/forms ^21.x
  • @angular/animations ^21.x
Terminal window
cd packages/Angular/Generic/ai-test-harness
npm run build

ISC