monkai-hub-cli
Command-line interface for MonkAI Hub — configure, run and manage agent tests directly from your terminal.
Designed to be operated by AI assistants (Claude Code, Copilot, Cursor) and developers who prefer the terminal over the web UI. All output is JSON for easy parsing and scripting.
Why a CLI?
The MonkAI Hub web dashboard is great for browsing results and visual analysis. But when you want to:
- Create dozens of test cases programmatically instead of clicking through forms
- Run tests from CI/CD pipelines without browser automation
- Let an AI assistant configure and execute tests based on a natural-language description
- Script test execution as part of a larger workflow
- Compare runs across different models in a reproducible way
…the CLI is the right tool. Everything you can do in the Hub UI for testing, you can do here — without leaving your terminal.
Installation
pip install monkai-hub-cli
Requires Python 3.9 or newer. Verify the install:
monkai-hub --help
Quick start
1. Authenticate
Log in with your MonkAI Hub credentials. The CLI saves a JWT to ~/.monkai-hub/auth.json and refreshes it automatically.
monkai-hub login --email you@company.com --password your-password
You can also export credentials as environment variables to avoid typing them every time:
export MONKAI_EMAIL=you@company.com
export MONKAI_PASSWORD=your-password
monkai-hub login
2. Create a test
monkai-hub test create \
--name "Greeting Test" \
--api-url https://my-agent.example.com/chat \
--headers '{"Authorization":"Bearer abc123"}' \
--interactions '[
{"user_message":"Hello","ai_message_official":"Hi there!"},
{"user_message":"How are you?","ai_message_official":"I am well, thanks!"}
]'
The response includes the new test_id — copy it for the next steps.
3. Run the test
The execution happens on the MonkAI Tester server (proxied via the Hub's Edge Function — no API keys needed in the CLI):
monkai-hub test run <test-id>
You get back the execution summary: total, passed, failed, pass_rate, and an execution_id.
4. View the results
monkai-hub test results <execution-id>
The full execution metadata plus every individual result row, ready to be piped into jq or any other JSON processor.
Commands
Authentication
| Command | Description |
|---|---|
monkai-hub login |
Authenticate with MonkAI Hub. Stores JWT locally. |
monkai-hub logout |
Remove stored credentials. |
Test management
| Command | Description |
|---|---|
monkai-hub test create |
Create a new agent test, optionally with interactions. |
monkai-hub test add-interaction <test-id> |
Append a new interaction to an existing test. |
monkai-hub test list |
List all your tests. |
monkai-hub test get <test-id> |
Show test details and all interactions. |
Execution
| Command | Description |
|---|---|
monkai-hub test run <test-id> |
Execute a test remotely via the MonkAI Tester server. |
monkai-hub test results <execution-id> |
Show all results from an execution. |
monkai-hub test executions [test-id] |
List executions, optionally filtered by test. |
Run monkai-hub <command> --help on any command for the full option list.
Output format
Every command writes a JSON document to stdout. Success looks like this:
{
"status": "ok",
"test_id": "abc-123",
"name": "Greeting Test",
"interactions": 2
}
Errors include a stable error code so scripts can branch on the failure type:
{
"status": "error",
"code": "AUTH_ERROR",
"message": "Login failed: Invalid login credentials"
}
| Code | When |
|---|---|
AUTH_ERROR |
Login failed or token expired and refresh failed. |
VALIDATION_ERROR |
A flag value (JSON, etc.) is malformed. |
HUB_ERROR |
Supabase request failed (network, RLS, invalid IDs). |
REMOTE_ERROR |
Test execution on the Tester server failed. |
Exit code is 0 on success, 1 on any error.
How it works
The CLI is a thin HTTP wrapper. It does not import any internal MonkAI library — every operation is a REST call:
monkai-hub-cli
│
├── auth.py ──> Supabase Auth (email/password → JWT)
│
├── supabase_client.py ──> Supabase REST API
│ (agent_tests, agent_test_interactions,
│ agent_test_executions, agent_execution_results)
│
└── tester_client.py ──> Supabase Edge Function (python-test-executor)
│
└──> MonkAI Tester (Railway server)
All credentials stay server-side. The CLI only ever holds the user's JWT, which is bound to that user's Row Level Security policies in Supabase. There is no API key for the Tester server in the CLI — the Edge Function holds it and gates access by JWT.
Use with AI assistants
The JSON-only output is intentional: AI assistants (Claude Code, Cursor, Copilot CLI, etc.) can call the CLI, parse the response, and chain commands without screen-scraping or fragile text parsing.
Example prompt to an assistant:
"Create a test in MonkAI Hub for the agent at
https://my-agent.example.com/chat. Use these three interactions: greet the user, ask for their order number, confirm the order. Then run the test and show me the results."
The assistant runs monkai-hub test create, captures the test_id from the JSON, runs monkai-hub test run, captures the execution_id, and finally calls monkai-hub test results — all without human intervention.
Contributing
Issues and pull requests are welcome at github.com/BeMonkAI/monkai-hub-cli.
git clone https://github.com/BeMonkAI/monkai-hub-cli.git
cd monkai-hub-cli
python -m venv .venv && source .venv/bin/activate
pip install -e .
pip install pytest
pytest tests/ -v
Links
- MonkAI Hub: https://www.monkaihub.com
- PyPI package: https://pypi.org/project/monkai-hub-cli/
- Issues: https://github.com/BeMonkAI/monkai-hub-cli/issues
License
MIT — see LICENSE.
Metadata
Release files for monkai-hub-cli 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| monkai_hub_cli-0.1.1.tar.gz | 11.8 kB | Without provenance | Details for monkai_hub_cli-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| monkai_hub_cli-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for monkai_hub_cli-0.1.1-py3-none-any.whl |
Total release size: 25.8 kB
Release files / monkai_hub_cli-0.1.1.tar.gz
| Download URL | monkai_hub_cli-0.1.1.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35a987a72018fe7a6ddeb9f74b51dd9eff4c01d6c0c165c9a50ee2f4dea49c5b
|
|
BLAKE2b-256 checksum How to use checksums |
b970ce4f8feefcaa8ade0588f7089214688c728af7cd707f883b04eee6dd9e8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / monkai_hub_cli-0.1.1-py3-none-any.whl
| Download URL | monkai_hub_cli-0.1.1-py3-none-any.whl |
|---|---|
| Size | 14.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3e03d4b01921bdf69b9a7a2821c6e78d8e3acc5cf41d4b9f24134845eacb55d
|
|
BLAKE2b-256 checksum How to use checksums |
adc8a18848b23142a1853eb9a704c0a1e3037c27f30308eafaa446cacdf56224
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for monkai-hub-cli 0.1.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.