Run a targeted selection of saved tests

POST /Platform/lab/run-tests

Run a targeted selection of saved tests.

Selection is by explicit test_ids or an HQL query returning AgentTest rows (e.g. AgentTest | name ilike '%schedule%' | limit 10). There is deliberately no run-everything selector: every test run is real LLM calls, so a run covers only the tests touching the Document/behavior that changed.

response_samples is the model-generation consistency knob: N fresh generations, each check-evaluated once; the outcome is PASSED only when all samples pass, and mixed results are FLAKY with the pass fraction (e.g. 4/5). One sample is the normal targeted check. Use response_samples=5 for consistency-sensitive, high-impact, or previously flaky behavior. FLAKY means the behavior is sensitive; the remedy is tighter instructions, not rerolling. judge_runs separately retries the LLM judge against the SAME response for semantic-check stability (never regenerates). Cost is roughly response_samples agent generations + response_samples x judge_runs x semantic_checks judge calls per test.

With branch, tests are loaded on that branch and live-mode entities rebuild from that branch's state — the validation step after a branch edit, before promoting to main. Each execution also persists an immutable AgentTestRun record, so run history is queryable per test.

Selection may mix AgentTests, SimulationTests (ad-hoc persistent multi-turn tests) and Workflows. A Workflow id runs that workflow's own acceptance scenarios (Workflow.run_scenarios: one simulated conversation per scenario applicable to the agent's answers, one entry per scenario) and needs agent_id. Ids are dispatched by type; kind on each result entry says which ran. A SimulationTest execution drives n whole simulated conversations (mock forced) and persists a SimulationTestRun (run_id + conversation_ids on the entry). response_samples/judge_runs/use_cache do not apply to them (their n and threshold are stored on the test), and their conversations are ephemeral (in memory, never persisted; the SimulationTestRun keeps the transcript), so branch — main included — only selects the agent state under test.

Costs money, and is the slowest operation here by far: up to max_tests x response_samples agent generations plus judge calls, so a 10-test x 5-sample gate runs many minutes. It supports asynchronous execution with a pollable result; AgentTestRun records persist per test regardless, so results of a run whose client disconnected are still queryable.

Body parameters

Returns

RunTestsResponse

Example request

curl -X POST "https://api.hilus.ai/Platform/lab/run-tests" \
  -H "Authorization: Bearer $HILUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'