Save an agent reply as a regression test

POST /Platform/lab/create-test

Save an agent reply as a regression test.

Use this for recurring, high-impact, fragile, or broadly shared behavior that should be guarded permanently. The turn (conversation stump, view blocks, time context) is frozen together with the checks and executed via run_tests. One-off configuration corrections for a single organization generally rely on focused replay/simulation instead.

Frozen vs live context: by default every entity view is frozen as captured at the incident — the test verifies model behavior on that exact state. Entities intended for continued editing (usually the instructions Document) belong in live_entity_keys (e.g. ["Document:7hT2mQx..."]) so their views are rebuilt from current state on each run — required for tests meant to validate future doc edits.

Persistence and execution are separate: once saving succeeds, a failed initial run does NOT roll back the test. The response's initial_run_status distinguishes passed | failed | flaky | error | not_requested.

With run=True (the default) this performs a real agent generation plus judge calls, so it costs money and is long-running; it supports asynchronous execution with a pollable result. The test is persisted regardless of run outcome — a client-side timeout never means the test wasn't created, so existing AgentTests are checked before retrying.

Body parameters

Returns

CreateTestResponse

Example request

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