Creates a new AI Test Harness component instance.
Angular DomSanitizer for safe HTML rendering of formatted content
Angular ChangeDetectorRef for managing change detection
Currently active tab in the sidebar
Advanced LLM Parameters
Whether advanced parameters panel is expanded
Selected AI configuration for agent execution
Unified variables for agent execution (combines data context and template data)
Available AI configurations
Available AI models for prompt execution
Available AI vendors for the selected model
Complete array of all messages in the current conversation session
Current agent run being displayed in execution monitor
ID of the currently active/loaded conversation, if any
Current JSON content to display in the dialog
Current text input by the user (bound to textarea)
The entity to test - either an AI Agent or AI Prompt
Mode for the execution monitor component
Whether a re-run has been executed (shows Reset button instead of Re-Run)
Whether an agent execution is currently in progress
Tracks agent steps during live execution (deprecated - now using agent run's Steps directly)
Maximum tokens for prompt execution
Event emitted when the component requests to be minimized (e.g., when navigating to a run)
The mode of operation - either 'agent' or 'prompt'
Name for the new conversation being saved
The original prompt run ID when re-running a previous prompt execution
If specified, this provider will be used for communication and for all metadata purposes. By default, if not provided, the Metadata and RunView classes are used for this and the default GraphQLDataProvider is used which is connected to the same back-end MJAPI instance as the Metadata and RunView classes. If you want to have this component connect to a different MJAPI back-end, create an instance of a ProviderBase sub-class like GraphQLDataProvider/etc, and configure it as appropriate to connect to the MJAPI back-end you want to use, and then pass it in here.
ProtectedresponseAvailable response format options
Emitted when the user navigates to view a run (agent or prompt)
Array of saved conversation sessions loaded from localStorage
Selected AI configuration for prompt execution
Selected AI model for prompt execution
Selected response format for prompt execution
Selected AI vendor for prompt execution
Flag to control JSON dialog visibility
Whether the JSON viewer window is visible
Whether to show the load confirmation dialog
Whether to show the save conversation dialog
Whether the configuration sidebar is currently visible
Whether to skip validation when running prompts
Raw stop sequences input for textarea
The system prompt override to use instead of rendering from template
Temporary name for the dialog input to avoid binding conflicts
Variables for prompt template rendering
Event emitted when the visibility state changes, allowing parent components to react
StaticɵdirStaticɵfacControls the visibility of the test harness. When set to true, automatically resets the harness state. This property is typically controlled by parent components or dialog wrappers.
Returns either the default Metadata provider or the one specified in the Provider property, if it was specified
Returns either the default RunQuery provider or the one specified in the Provider property, if it was specified
Returns either the default RunReport provider or the one specified in the Provider property, if it was specified
Returns either the default RunView provider or the one specified in the Provider property, if it was specified
Adds a new empty agent variable to the collection. Agent variables are passed to the agent during execution for dynamic content and template rendering.
Adds a new empty template variable to the collection (prompt mode only). Template variables are used for prompt template rendering.
Cancels loading a conversation
Cancels the save dialog
Clears the current conversation after user confirmation. Resets both the message history and the current conversation ID.
Closes the test harness by setting visibility to false and emitting the change event. Used by dialog implementations and close buttons.
Closes the JSON dialog
Closes the JSON viewer window
Confirms loading a conversation after dialog confirmation
Handles the save dialog confirmation
Copies the JSON content to clipboard
Copies the message content to clipboard.
The message to copy
Automatically detects the content type of a message for appropriate rendering. Uses pattern matching to identify JSON, Markdown, or plain text content.
Content string to analyze
Detected content type ('markdown', 'json', or 'text')
Executes a re-run of a previously loaded prompt run. This bypasses the need for a new user message since we're re-running with existing messages.
Formats execution time from milliseconds into a human-readable string. Automatically selects appropriate units (minutes, seconds, or milliseconds).
Execution time in milliseconds
Formatted time string (e.g., "2m 30.5s", "1.23s", "500ms")
Formats JSON content with proper indentation for display. Also recursively parses any nested JSON strings.
JSON string to format
Formatted JSON string or original content if parsing fails
Formats a Date object into a user-friendly time string.
Date object to format
Formatted time string in HH:MM format
Gets the icon class for the current entity
Gets the logo URL for the entity (agent only)
Gets the display name of the current entity
Gets a summary of the execution for tooltip display
The message to get execution summary for
A brief summary of the execution steps
Formats streaming content with markdown rendering
The message containing streaming content
SafeHtml formatted content
Get the last run ID from conversation messages
Generates CSS class names for message display based on message properties.
The conversation message to generate classes for
Space-separated CSS class string for styling
Handles keyboard input in the message textarea. Sends message on Enter (without Shift) and allows multi-line input with Shift+Enter.
Keyboard event from the textarea
Checks if the entity has a logo URL
Checks if a message contains JSON content that has extractable human-readable content. Used to determine if the raw toggle should be shown.
The conversation message to check
True if the message has extractable content different from raw JSON
Checks if the payload should be displayed (not null, undefined, or empty object)
The payload to check
true if the payload has content, false otherwise
Case-insensitive UUID comparison for configuration ID matching in templates.
Determines if the provided content is valid JSON.
String content to test
True if content can be parsed as JSON, false otherwise
Navigates to the AI Agent Run form to view detailed execution information
The ID of the agent run to view
Navigate to the run details form
Starts a new conversation
Post-view check hook that handles auto-scrolling to the bottom of the message container when new content is added.
Responds to input property changes, particularly when entity is set/changed
Component cleanup. Destroys subscriptions and clears any active intervals to prevent memory leaks.
Component initialization. Loads saved conversations, sets up event subscriptions, and initializes the harness to a clean state.
Handles model selection change and loads available vendors for the selected model
Removes an agent variable at the specified index.
Zero-based index of the variable to remove
Removes a template variable at the specified index (prompt mode only).
Zero-based index of the variable to remove
Resets the test harness to its initial state, clearing all conversations, variables, and UI state. Called automatically when the harness becomes visible.
Resets the conversation back to the original messages from the prompt run. This is available after a re-run has been executed.
Resets all model settings to the prompt defaults
Saves the current conversation to localStorage with user-provided name. Handles both creating new conversations and updating existing ones. Automatically limits storage to 50 conversations to prevent excessive memory usage.
Switches to the specified tab in the configuration sidebar.
The tab to activate
Shows the execution history for a specific message
The message to show execution history for
Shows the raw JSON dialog for a specific message
The message to show raw JSON for
Determines whether to show the raw toggle button for a message. Combines the logic for raw content availability and extractable content.
The conversation message to check
True if the raw toggle should be displayed
Toggles the advanced parameters expansion panel
Toggles the collapsed state of a message's payload section
The message to toggle payload visibility for
Toggles the visibility of the configuration sidebar. Allows users to show/hide the data context and conversation management panels.
Updates stop sequences from the textarea input
Comprehensive test harness component for AI Agent development and testing. Provides a full-featured chat interface with conversation management, data context configuration, template data management, streaming responses, conversation persistence, and import/export capabilities.
Key Features:
Usage:
Example