Developer and operator guide for non-production load-test setups using the Agents plugin loadtest_mock service type and the mattermost-ai load-test-ng controller.
This document applies to load-test and staging environments only. It describes:
- The in-process mock LLM (
loadtest_mock) that implementsllm.LanguageModelinside the plugin process. - Tool execution policy (
auto_run_everywhere) so MCP tool calls run without human approval during simulations. - Enabling the Agents plugin (
mattermost-ai) and its simulator actions from mattermost-load-test-ng.
It does not replace production LLM configuration or security review for real provider traffic.
The loadtest_mock service type selects a validated, in-process loadtest.MockLLM before any Bifrost client is created. It is not a Bifrost provider, plugin transport, or standalone HTTP mock service. No external mock LLM endpoint is required.
Assign the bot to a service with "type": "loadtest_mock" and optional raw JSON in loadTestMockConfig:
{
"type": "loadtest_mock",
"loadTestMockConfig": {
"seed": 42,
"profile_weights": {
"realistic_default": 0.8,
"realistic_fast": 0.2,
"realistic_slow": 0
}
}
}-
Nil, empty, or whitespace-only
loadTestMockConfigmerges ontoDefaultReadSearchHeavyProfile()fromloadtest.ParseProfile(). -
Invalid JSON or unknown fields fail parsing before the mock is constructed; check server logs for
failed to parse load-test mock profile. -
At plugin startup, when the mock LLM is initialized, the server logs a single run-audit snapshot:
- Message:
Initialized load-test mock LLM - Field
profile_summary: multiline text with latency ranges, weights, tool argument distributions, anddefaults_source=spikes/llm-latency-benchmark
- Message:
The summary is emitted once per bot service initialization, not per chat request or stream chunk.
Mattermost MCP tools respect channel/user policy in the System Console. For unattended load tests, tool calls must not block on approval prompts.
Configure MCP tool policies so relevant tools use auto_run_everywhere (see webapp System Console components such as mcp_tool_config_row.tsx). Without this, simulations may stall waiting for approval while the mock LLM still completes streams.
Integration is cross-repository:
- This repo exposes
github.com/mattermost/mattermost-plugin-agents/loadtest/controller(a standalone nested Go module) for blank-import registration of the Agents SimulController. - mattermost-load-test-ng must import that package and include
mattermost-aiinEnabledPluginsfor the simulated server configuration.
Plugin ID: mattermost-ai (not agents).
Registered actions (names matter for simulator wiring):
mattermost-ai.AskAgentChannelMentionmattermost-ai.AskAgentDM
Controller configuration:
- Default file path:
./config/mattermost-ai-loadtest.json - Override with environment variable:
MM_AGENTS_LOADTEST_CONFIGpointing at a JSON file
Trigger frequencies (triggerFrequencyChannelMention, triggerFrequencyDM) are relative weights inside load-test-ng, not global percentages. For example, 0.001 is one-thousandth the weight of an action configured with frequency 1.0. The simulator scales from the smallest non-zero frequency.
Example mattermost-ai-loadtest.json:
{
"triggerFrequencyChannelMention": 0.001,
"triggerFrequencyDM": 0.001,
"agentUsername": "ai",
"agentUserID": "",
"triggerMode": "both",
"promptProfile": "mixed",
"mockProfile": null
}Optional mockProfile embeds the same JSON schema as loadTestMockConfig when your ng-side harness merges mock defaults with simulator config (validated via loadtest.ParseProfile on read).
During development, you may use temporary replace directives in a local go.mod; do not commit unstable replace pins aimed only at your laptop.
Unless overridden, the empirical read/search-heavy defaults apply (derived from spikes/llm-latency-benchmark/):
| Latency mix | TTFT (ms) | chunk_count | chunk_interval_ms | total_wall_time_ms_per_request |
|---|---|---|---|---|
realistic_default |
3000-12000 | 150-400 | 30-80 | 15000-25000 |
realistic_fast |
600-2500 | 40-120 | 40-100 | 5000-10000 |
realistic_slow |
12000-22000 | 400-1000 | 15-40 | 28000-40000 |
- Profile weights (default):
realistic_default0.70,realistic_fast0.20,realistic_slow0.10 reasoning_skip_probability: 0.10- Streaming is enabled by default (
streaming_enabled: true)
See the active merged profile in logs under profile_summary after initialization.
From the Agents plugin repository:
go test ./loadtest/... ./bots/... ./toolrunner/... -race
# The SimulController lives in a separate nested module, so test it on its own:
(cd loadtest/controller && go test ./... -race)Run an integrated mattermost-load-test-ng scenario only after both this branch (or equivalent) and the ng-side wiring branch are available; remove or document any temporary replace directives first.
| Symptom | What to check |
|---|---|
Plugin fails to start or bot LLM errors mentioning loadtest profile |
Fix loadTestMockConfig JSON (unknown fields are rejected). Validate weights sum positively and reference existing latency profile keys. |
| No simulated agent traffic | Confirm EnabledPlugins includes mattermost-ai. Confirm ng imports github.com/mattermost/mattermost-plugin-agents/loadtest/controller. |
| Actions never hit the agent user | Verify agentUsername / agentUserID match a real bot user in the test data set; check simulator logs for target resolution errors. |
| Tool calls hang or never execute | Ensure MCP tools use auto_run_everywhere for load-test channels/users so approvals do not block automation. |
| Need to confirm mock parameters | Search logs for Initialized load-test mock LLM and read profile_summary (initialization-time only). |