---
title: "Never wait for input when no person is · Agent Wranglers"
url: https://agentwranglers.se/playbook/developer-tools/command-line-behaviour/non-interactive-mode
id: DEV-4
level: Recommended
updated: 2026-10-27
build: a2a6bdfed830
tokens: 886
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Never wait for input when no person is there

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Command-line behaviour](https://agentwranglers.se/playbook/developer-tools/command-line-behaviour.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: DEV-4
- Level: Recommended
- Chapter: [Command-line behaviour](https://agentwranglers.se/playbook/developer-tools/command-line-behaviour.md)
- Rule: Prompt only when standard input is a terminal. Otherwise fail at once with a message that names the flag that answers the question, and offer `--yes` and `--no-input` flags.
- Check: A test runs every command with standard input closed and a 10 second limit. Each run either finishes or exits non-zero with a message that names a flag. None hits the time limit.
- How: A prompt in a CI job or an agent's shell hangs until a timeout kills it. Check whether standard input is a terminal before each prompt. Every value the tool can prompt for also has a flag or an environment variable. Sign-in without a keyboard or browser follows [sign in devices without a keyboard through a second screen](https://agentwranglers.se/playbook/accounts/sign-in-methods/device-sign-in.md), or takes a token from the environment.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### Python example

```python
import sys

def confirm(question: str, assume_yes: bool) -> bool:
    if assume_yes:
        return True
    if not sys.stdin.isatty():
        print(f"{question} Refusing to ask without a terminal. Pass --yes to confirm.", file=sys.stderr)
        sys.exit(EXIT_USAGE)
    return input(f"{question} [y/N] ").strip().lower() == "y"
```

### Go example

```go
func confirm(question string, assumeYes bool) bool {
	if assumeYes {
		return true
	}
	if !term.IsTerminal(int(os.Stdin.Fd())) {
		fmt.Fprintf(os.Stderr, "%s Refusing to ask without a terminal. Pass --yes to confirm.\n", question)
		os.Exit(exitUsage)
	}
	fmt.Fprintf(os.Stderr, "%s [y/N] ", question)
	answer, _ := bufio.NewReader(os.Stdin).ReadString('\n')
	return strings.TrimSpace(strings.ToLower(answer)) == "y"
}
```

## Related rules

- ACC-15 [Sign in devices without a keyboard through a second screen](https://agentwranglers.se/playbook/accounts/sign-in-methods/device-sign-in.md) in Accounts and identity
- DEV-5 [Show a dry run and ask before destructive commands](https://agentwranglers.se/playbook/developer-tools/command-line-behaviour/dry-run.md) in Developer tools, SDKs and CLIs

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/developer-tools/command-line-behaviour/non-interactive-mode">Agent Wranglers developer tools, SDKs and CLIs playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Offer JSON output with a stable shape](https://agentwranglers.se/playbook/developer-tools/command-line-behaviour/json-output.md)
- Next: [Show a dry run and ask before destructive commands](https://agentwranglers.se/playbook/developer-tools/command-line-behaviour/dry-run.md)
- [Command-line behaviour](https://agentwranglers.se/playbook/developer-tools/command-line-behaviour.md)
