Python CLIs for agents and humans
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file humancli-0.4.0.tar.gz.
File metadata
- Download URL: humancli-0.4.0.tar.gz
- Upload date:
- Size: 65.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc8fa162de865282c39188fd66cf020df29e7c6280c9e835a41dff32d4750d24
|
|
| MD5 |
61ed4bacb62a4c3ba26df64f1d8ba98e
|
|
| BLAKE2b-256 |
b14b2ab6be451df513f413816b234a4e1b21b2dc39d2d90283e092a5c2659809
|
Provenance
The following attestation bundles were made for humancli-0.4.0.tar.gz:
Publisher:
release.yml on elyase/agentcli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
humancli-0.4.0.tar.gz -
Subject digest:
cc8fa162de865282c39188fd66cf020df29e7c6280c9e835a41dff32d4750d24 - Sigstore transparency entry: 1154782292
- Sigstore integration time:
-
Permalink:
elyase/agentcli@3e27d0db6bdb5fc4cfb55cc896b12e071850f0bd -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/elyase
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3e27d0db6bdb5fc4cfb55cc896b12e071850f0bd -
Trigger Event:
push
-
Statement type:
File details
Details for the file humancli-0.4.0-py3-none-any.whl.
File metadata
- Download URL: humancli-0.4.0-py3-none-any.whl
- Upload date:
- Size: 21.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fb307bf146e9dcd65704a211fea14f6be1d5c9032d0eec6170c631265d01636
|
|
| MD5 |
cd24037901bf1eff15de0d8b3fa39da3
|
|
| BLAKE2b-256 |
5bb2336bf0d41bd239c7cc84c75ee9c203cfe213fc8f2997d20b4ea5607afa1f
|
Provenance
The following attestation bundles were made for humancli-0.4.0-py3-none-any.whl:
Publisher:
release.yml on elyase/agentcli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
humancli-0.4.0-py3-none-any.whl -
Subject digest:
1fb307bf146e9dcd65704a211fea14f6be1d5c9032d0eec6170c631265d01636 - Sigstore transparency entry: 1154782298
- Sigstore integration time:
-
Permalink:
elyase/agentcli@3e27d0db6bdb5fc4cfb55cc896b12e071850f0bd -
Branch / Tag:
refs/tags/v0.4.0 - Owner: https://github.com/elyase
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3e27d0db6bdb5fc4cfb55cc896b12e071850f0bd -
Trigger Event:
push
-
Statement type: