Skip to main content

generate_feature

Dispatch AI test generation for a feature. Returns immediately with a requestId; the pipeline runs in a cloud sandbox for several minutes.

warning

Generation consumes account credits. One generation per feature at a time — a second dispatch while one is in flight returns 409 conflict.

Request​

POST /api/v1/ops/projects/{project}/features/{feature}/generate
ParameterInTypeRequiredDescription
projectpathstringyesThe project's public id.
featurepathstringyesFeature id or name.
siteUrlbodystringnoTest site URL override (defaults to the project's configured URL).
curl -X POST -H "Authorization: Bearer $TESTVIBE_API_KEY" \
-H "Content-Type: application/json" -d '{}' \
"$TESTVIBE_SERVER/api/v1/ops/projects/$PROJECT/features/12/generate"

Response​

202 Accepted

{ "requestId": "a1b2c3d4-…", "featureId": 12 }

The feature's status flips to generating; track progress via get_generation_status and branch on isTerminal, terminalReason, or awaitingInput.

info

--watch follows it to the end and exits 0 only when the generation actually succeeded — 1 if it failed or was cancelled, 2 if it parked to ask you a question, 3 if --timeout (default 5400 s) elapsed first. See the CLI wait contract.

Errors​

HTTPWhen
404 not_foundNo such feature in this project.
409 conflictAlready generating, or the dispatch was rejected.

Additional dispatch options​

Body fieldTypeBehavior
modelstringExact id from GET …/projects/{project}/models / list_models / testvibe models; omit for the project default, or use auto for model selection. Applies only to this generation.
gherkinChangesstringask (default), accept, deny, or stop. Unknown values fall back to ask.
notifybooleanDefault false; opt into normal completion notifications. CLI: --notify.
preflightbooleanREST/MCP: return the target, mutation risk, references, and confirmation information without starting generation or choosing a model. Returns 200.
confirmstringREST/MCP: echo the preflight token when the deployment's transactional confirmation gate requires it. A source edit invalidates the token.

Generation drives the target application live. Its steps can change target data during generation, before a separately dispatched test run. A required confirmation returns 409 confirmation_required; unknown models return 400 invalid_model. Do not hard-code the model catalog: inspect ids and configured on the current installation. Model selection responses can add model, modelSource, and modelReason.

Answer a paused generation​

Poll generation status. If awaitingInput is true, send exactly one answer shape to:

POST /api/v1/ops/projects/{project}/features/{feature}/generation/answer

The body is {requestId?, option}, {requestId?, message}, or {requestId?, fields:[{name,value}]}. Prefer the question's pendingInput.requestId when present. Do not substitute an unrelated workflow request id. The response is 202 with ok, requestId, featureId, applied, and decision; resumed work can have a newRequestId.

testvibe generate answer 12 --option "<exact option from pendingInput>" --watch

MCP uses answer_generation with feature, optional requestId, and option, message, or fieldsJson (a JSON-encoded array). An already answered/cancelled question returns 409. Inspect a resume_unavailable or resume_failed response before deciding whether fresh generation is required.