agentcli
Python CLIs for agents and humans.
agentcli builds command-line interfaces that produce structured, parseable output for AI agents while remaining human-friendly. Type hints are the schema — a function signature IS the CLI specification.
Install
pip install humancli
The package installs as humancli on PyPI and you import it as humancli:
from humancli import App
Quick start
Single function
from humancli import run
def greet(name: str):
"""Greet someone."""
return {"message": f"hello {name}"}
run(greet)
$ greet world
message: hello world
$ greet world --json
{"ok": true, "data": {"message": "hello world"}}
$ greet --llms
# greet
| Command | Description |
|---------|-------------|
| `greet <name>` | Greet someone |
Multi-command app
from humancli import App
app = App("my-cli", version="1.0.0")
@app.command
def status():
"""Show status."""
return {"clean": True, "branch": "main"}
@app.command
def install(package: str, *, save_dev: bool = False):
"""Install a package."""
return {"added": 1, "packages": 451}
app()
Parameters before * are positional arguments. Parameters after * are named options/flags. This is just Python's own syntax.
Parameter metadata
from typing import Annotated, Literal
from humancli import App, Param
app = App("deploy-cli")
@app.command
def deploy(
env: Annotated[Literal["staging", "prod"], Param(help="Target environment")],
*,
token: Annotated[str, Param(env="DEPLOY_TOKEN", secret=True)] = "",
):
"""Deploy to an environment."""
return {"url": f"https://{env}.example.com"}
app()
Sub-apps
app = App("gh")
pr = App("pr")
@pr.command
def list_(*, state: Literal["open", "closed"] = "open"):
"""List pull requests."""
return {"prs": [], "state": state}
app.mount(pr)
app()
# $ gh pr list --state closed
Default commands
app = App("fetch")
@app.default
def fetch_cases(*, limit: int = 20):
"""Fetch cases."""
return {"fetched": limit}
# Runs when no sub-command is given:
# $ fetch --limit 5
Agent discovery
Every humancli app gets built-in flags for agent consumption:
--llms— markdown command index--llms-full— full JSON schema of all commands--json/--yaml/--jsonl— structured output formats--mcp— start as an MCP server (requireshumancli[mcp])
Optional extras
pip install humancli[rich] # rich terminal formatting
pip install humancli[pydantic] # pydantic model support
pip install humancli[yaml] # yaml output format
pip install humancli[mcp] # MCP server mode
pip install humancli[all] # everything
License
MIT
Metadata
Release files for humancli 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| humancli-0.4.0.tar.gz | 65.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| humancli-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 87.2 kB
Release files / humancli-0.4.0.tar.gz
| Download URL | humancli-0.4.0.tar.gz |
|---|---|
| Size | 65.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cc8fa162de865282c39188fd66cf020df29e7c6280c9e835a41dff32d4750d24
|
|
BLAKE2b-256 checksum How to use checksums |
b14b2ab6be451df513f413816b234a4e1b21b2dc39d2d90283e092a5c2659809
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 22, 2026.
Transparency logRelease files / humancli-0.4.0-py3-none-any.whl
| Download URL | humancli-0.4.0-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1fb307bf146e9dcd65704a211fea14f6be1d5c9032d0eec6170c631265d01636
|
|
BLAKE2b-256 checksum How to use checksums |
5bb2336bf0d41bd239c7cc84c75ee9c203cfe213fc8f2997d20b4ea5607afa1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 22, 2026.
Transparency log