Skip to main content

Human-action handoffs

Testronaut can stop a browser mission when continuing requires a person. This differs from request_human_input, which pauses an active terminal run to collect a short code. A handoff ends the current agent run with structured metadata so another application can notify a user, present the protected page, and decide whether to retry.

Instruct the agent​

Include an explicit safe-stop rule in the mission:

Never solve or bypass CAPTCHA, bot detection, access controls,
authentication, or eligibility checks.

If a person must act before the mission can continue, stop and report:
HUMAN_ACTION_REQUIRED[category]: short reason

Supported categories are bot_check, captcha, authentication, verification, eligibility, and other.

Do not use a handoff for an expired offer, a closed survey, invalid input, or an ordinary application failure. Report those as FAILURE because a person cannot make the blocked journey resumable.

Structured result​

The mission result uses human_action_required and includes humanAction:

{
"status": "human_action_required",
"verification": "human_action_required",
"humanAction": {
"category": "bot_check",
"reason": "Complete the site's verification check.",
"resumable": true,
"resume": {
"available": true,
"strategy": "playwright_storage_state",
"statePath": "/tmp/browser-state.json"
}
}
}

The CLI report and summary count this separately from passed and failed missions. A human-action result exits nonzero so unattended CI does not mistake an incomplete journey for a pass.

Classify output in an integration​

The runner exports the same classifier used by the CLI:

import { classifyHumanAction, humanActionMetadata } from 'testronaut';

const handoff = humanActionMetadata(agentTranscript, {
storageStatePath: process.env.TESTRONAUT_STORAGE_STATE_PATH,
});

if (handoff) {
await saveJob({ status: 'human_action_required', humanAction: handoff });
await notifyUser(handoff.reason);
}

classifyHumanAction(text) returns the category, reason, and resumable flag. humanActionMetadata(text, options) also describes any configured storage-state resume strategy.

Resuming safely​

Set TESTRONAUT_STORAGE_STATE_PATH before the run to preserve cookies and local storage owned by the agent browser. An orchestrator can then:

  1. Store the structured handoff result and notify the user.
  2. Ask the user to complete the required action.
  3. Receive an explicit β€œcontinue” action from the user.
  4. Run the mission again with the same storage-state path and relevant mission inputs.

Storage state preserves the agent browser's session between attempts. It does not create a live shared browser, and it cannot import cookies from a separate Chrome or mobile tab. A challenge completed in another browser will help only when it changes shared server-side or account state. For a true same-session handback, the integrating product must provide an interactive view of the agent's browser session or an explicitly authorized browser-extension bridge.

Never automatically claim that a human completed the step, retry indefinitely, or weaken the protected site's controls. Keep a retry limit and retain a manual-completion option.

Controlled testing​

Use a synthetic checkpoint rather than a real retailer or production CAPTCHA. The Testronaut demo exposes a controlled fixture at:

https://demo.testronaut.app/?humanHandoff=bot-check&agentMode=true

The testronaut-examples repository includes missions/humanHandoff.mission.js, which verifies the fixture and returns a bot_check handoff without clicking the human-only control.