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
test_ids: optional str. Explicit AgentTest / SimulationTest / Workflow ids.hql: optional str. HQL selecting tests (rows with ids, e.g.Workflow | name ilike '%refill%'orAgentTest | name ilike '%schedule%' | limit 10).response_samples: optional int. Fresh generations per test (all must pass).judge_runs: optional int. Judge-stability retries per semantic check.use_cache: optional bool. Serve cached results when the FULL execution identity (context, checks, samples, judge config, branch) is unchanged. A cached 1-sample result never satisfies a 5-sample request.branch: optional str. Branch to load tests + live entities from.max_tests: optional int. Hard cap (default and maximum 10); narrow your HQL if exceeded.agent_id: optional str. Agent under test — required when a Workflow is selected (its tree answers decide which scenarios apply).scenario_ids: optional List[Any]. With Workflows, only these scenario ids.
Returns
RunTestsResponse
branch: optional str or null. Branch tests ran on; null means your configured branch.response_samples: int. Fresh generations per AgentTest.judge_runs: int. Judge retries per semantic check.estimated_agent_generations: int. Agent generations the AgentTests needed (tests x samples).elapsed_ms: float. Wall time of the run, in milliseconds.total: int. Entries in results.passed: int. Entries that passed.failed: int. Entries that failed.flaky: int. Entries that passed in some samples only.errored: int. Entries that could not run.results: optional List[RunTestsEntry]. One entry per test.
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 '{}'