python-agent-input
input() for Claude Code agents.
Claude Code hangs on input() because it cannot write to stdin. agent_input() replaces input() with an HTTP server — it prints curl instructions to stdout and blocks until the agent responds.
Important: Since agent_input() blocks, the agent must run the script using the Bash tool's run_in_background parameter (not &), then use the TaskOutput tool with block=false to check its stdout for curl instructions.
Usage
from python_agent_input import agent_input
name = agent_input("What is your name?")
print(f"Hello, {name}!")
Input validation
from python_agent_input import agent_input
def celsius_or_kelvin(value: str) -> str:
if value not in ("Celsius", "Kelvin"):
raise ValueError(f"Expected 'Celsius' or 'Kelvin', got '{value}'")
return value
temp = agent_input("Temperature in Fahrenheit?", example_response="72", validate=int)
unit = agent_input("Convert to Celsius or Kelvin?", validate=celsius_or_kelvin)
if unit == "Celsius":
print(f"{(temp - 32) * 5 / 9:.1f}°C")
else:
print(f"{(temp - 32) * 5 / 9 + 273.15:.1f}K")
Metadata
Release files for python-agent-input 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| python_agent_input-0.0.8.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_agent_input-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.3 kB
Release files / python_agent_input-0.0.8.tar.gz
| Download URL | python_agent_input-0.0.8.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ccd273c40a630d4f39f5d1adc8ac5cf82ccaf71a7bfa830e9b92be8ab57ea9a1
|
|
BLAKE2b-256 checksum How to use checksums |
2f5e9431c92a78ae81215f0b91aa8aea7aaef66f74b1ad4828cd0ec177a04457
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / python_agent_input-0.0.8-py3-none-any.whl
| Download URL | python_agent_input-0.0.8-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4daaa1a5bc08a60230daab5cc2f5139a7cc8ec7d69e602332083602a5c4603b8
|
|
BLAKE2b-256 checksum How to use checksums |
be7f88de02485f9adcc6969708a95196e23d33655d159dc540456911aca75876
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|