veris-cli 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. veris_cli-1.0.0/.gitignore +32 -0
  2. veris_cli-1.0.0/PKG-INFO +427 -0
  3. veris_cli-1.0.0/README.md +404 -0
  4. veris_cli-1.0.0/pyproject.toml +94 -0
  5. veris_cli-1.0.0/src/veris_cli/__init__.py +19 -0
  6. veris_cli-1.0.0/src/veris_cli/api.py +118 -0
  7. veris_cli-1.0.0/src/veris_cli/cli.py +29 -0
  8. veris_cli-1.0.0/src/veris_cli/commands/__init__.py +1 -0
  9. veris_cli-1.0.0/src/veris_cli/commands/config.py +32 -0
  10. veris_cli-1.0.0/src/veris_cli/commands/init.py +94 -0
  11. veris_cli-1.0.0/src/veris_cli/commands/scenario.py +200 -0
  12. veris_cli-1.0.0/src/veris_cli/commands/setup.py +548 -0
  13. veris_cli-1.0.0/src/veris_cli/commands/sim.py +219 -0
  14. veris_cli-1.0.0/src/veris_cli/config.py +63 -0
  15. veris_cli-1.0.0/src/veris_cli/fs.py +21 -0
  16. veris_cli-1.0.0/src/veris_cli/loaders.py +52 -0
  17. veris_cli-1.0.0/src/veris_cli/models/CLAUDE.md +1 -0
  18. veris_cli-1.0.0/src/veris_cli/models/README.md +30 -0
  19. veris_cli-1.0.0/src/veris_cli/models/agent_config.py +29 -0
  20. veris_cli-1.0.0/src/veris_cli/models/api.py +53 -0
  21. veris_cli-1.0.0/src/veris_cli/models/config.py +39 -0
  22. veris_cli-1.0.0/src/veris_cli/models/engine.py +85 -0
  23. veris_cli-1.0.0/src/veris_cli/models/evals/__init__.py +28 -0
  24. veris_cli-1.0.0/src/veris_cli/models/evals/api.py +56 -0
  25. veris_cli-1.0.0/src/veris_cli/models/evals/evaluation.py +45 -0
  26. veris_cli-1.0.0/src/veris_cli/models/evals/summary.py +19 -0
  27. veris_cli-1.0.0/src/veris_cli/models/scenarios/CLAUDE.md +1 -0
  28. veris_cli-1.0.0/src/veris_cli/models/scenarios/README.md +30 -0
  29. veris_cli-1.0.0/src/veris_cli/models/scenarios/__init__.py +34 -0
  30. veris_cli-1.0.0/src/veris_cli/models/scenarios/agent_spec.py +47 -0
  31. veris_cli-1.0.0/src/veris_cli/models/scenarios/config.py +18 -0
  32. veris_cli-1.0.0/src/veris_cli/models/scenarios/generation.py +43 -0
  33. veris_cli-1.0.0/src/veris_cli/models/scenarios/scenario.py +102 -0
  34. veris_cli-1.0.0/src/veris_cli/results.py +137 -0
  35. veris_cli-1.0.0/src/veris_cli/run_models.py +58 -0
  36. veris_cli-1.0.0/src/veris_cli/runner.py +111 -0
  37. veris_cli-1.0.0/src/veris_cli/runs.py +60 -0
  38. veris_cli-1.0.0/src/veris_cli/types.py +13 -0
@@ -0,0 +1,32 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.so
5
+ .Python
6
+ build/
7
+ develop-eggs/
8
+ dist/
9
+ downloads/
10
+ eggs/
11
+ .eggs/
12
+ lib/
13
+ lib64/
14
+ parts/
15
+ sdist/
16
+ var/
17
+ wheels/
18
+ *.egg-info/
19
+ .installed.cfg
20
+ *.egg
21
+
22
+ .pytest_cache/
23
+ .coverage
24
+ htmlcov/
25
+
26
+ .env
27
+ .env.local
28
+ .env.*.local
29
+
30
+
31
+ .git/
32
+ .venv
@@ -0,0 +1,427 @@
1
+ Metadata-Version: 2.4
2
+ Name: veris-cli
3
+ Version: 1.0.0
4
+ Summary: CLI to connect local agents to the Veris backend
5
+ Project-URL: Homepage, https://github.com/veris-ai/veris-cli
6
+ Project-URL: Bug Tracker, https://github.com/veris-ai/veris-cli/issues
7
+ Author: Veris
8
+ Requires-Python: >=3.11
9
+ Requires-Dist: httpx>=0.27
10
+ Requires-Dist: pydantic>=2.7
11
+ Requires-Dist: python-dotenv>=1.1.1
12
+ Requires-Dist: pyyaml>=6.0.1
13
+ Requires-Dist: rich>=13.7
14
+ Requires-Dist: tomli-w>=1.0.0
15
+ Requires-Dist: typer>=0.12
16
+ Requires-Dist: veris-ai[agents,fastapi,instrument]>=1.9.0
17
+ Provides-Extra: dev
18
+ Requires-Dist: pre-commit>=3.7.0; extra == 'dev'
19
+ Provides-Extra: test
20
+ Requires-Dist: pytest-cov>=4.1.0; extra == 'test'
21
+ Requires-Dist: pytest>=8.2; extra == 'test'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # veris-cli
25
+
26
+ [![PyPI version](https://badge.fury.io/py/veris-cli.svg)](https://badge.fury.io/py/veris-cli)
27
+ [![Tests](https://github.com/veris-ai/veris-cli/actions/workflows/test.yml/badge.svg)](https://github.com/veris-ai/veris-cli/actions/workflows/test.yml)
28
+ [![Python](https://img.shields.io/pypi/pyversions/veris-cli.svg)](https://pypi.org/project/veris-cli/)
29
+
30
+ Veris CLI package.
31
+
32
+ Installation:
33
+
34
+ ### From PyPI (recommended)
35
+ ```bash
36
+ # Using pip
37
+ pip install veris-cli
38
+
39
+ # Using uv tool
40
+ uv tool install veris-cli
41
+ ```
42
+
43
+ ### From GitHub
44
+ ```bash
45
+ # Latest from main branch
46
+ uv tool install 'git+https://github.com/veris-ai/veris-cli.git'
47
+
48
+ # Verify installation
49
+ uv tool list --show-paths
50
+ veris init --help
51
+ ```
52
+
53
+ Upgrade:
54
+ ```
55
+ uv tool upgrade veris-cli
56
+ ```
57
+
58
+ Uninstall:
59
+ ```
60
+ uv tool uninstall veris-cli
61
+ ```
62
+
63
+ Usage:
64
+ ```
65
+ veris init
66
+ ```
67
+
68
+ ## Quickstart
69
+
70
+ This quickstart will guide you through running Veris simulations against the example app in [mini_crm](https://github.com/veris-ai/mini_crm) using the [OpenAI agents](https://openai.github.io/openai-agents-python/) framework.
71
+
72
+ Choose one integration path:
73
+ - Decorators (mini_crm `veris_decorators` branch): `@veris.mock` adorns tools
74
+ - Docs: https://github.com/veris-ai/veris-python-sdk?tab=readme-ov-file#core-decorators
75
+ - mini_crm branch: https://github.com/veris-ai/mini_crm/tree/veris_decorators
76
+ - Instrumentor (mini_crm `veris_instrument` branch): use `Runner.run(..., veris_config=...)`
77
+ - Docs: https://github.com/veris-ai/veris-python-sdk?tab=readme-ov-file#core-instrument
78
+ - mini_crm branch: https://github.com/veris-ai/mini_crm/tree/veris_instrument
79
+
80
+ _You may use this as reference for your own repo._
81
+
82
+ 1. Ensure you have ngrok configured.
83
+
84
+ Otherwise refer to their [getting started](https://ngrok.com/docs/getting-started/) guide to get it set up.
85
+
86
+ 2. Follow the steps in the [mini_crm quickstart](https://github.com/veris-ai/mini_crm?tab=readme-ov-file#quickstart--mini-crm-lead-qualifier) to set up the agent.
87
+
88
+ Verify your path is set to the root directory `.../mini_crm/`.
89
+
90
+ 3. Install dependencies
91
+
92
+ Inside the same environment where you downloaded the dependencies for `mini_crm`.
93
+ ```bash
94
+ pip install veris-ai
95
+ ```
96
+
97
+ 4. Initialize `.veris` config in your repo.
98
+
99
+ Advisable to add `.veris` to `.gitignore`.
100
+ ```bash
101
+ veris init
102
+ ```
103
+ This will setup the config scaffolding for VERIS.
104
+
105
+ 5. Obtain an API key and assign it to `VERIS_API_KEY`.
106
+
107
+ Get your API key from https://simulator.veris.ai/ (you will need an account).
108
+ ```bash
109
+ # Option A: store in .env (auto-loaded)
110
+ echo 'VERIS_API_KEY=<your-api-key>' >> .env
111
+
112
+ # Option B: export in your shell
113
+ export VERIS_API_KEY="<your-api-key>"
114
+ ```
115
+
116
+ 6. Set `ENV` environment variable
117
+ ```bash
118
+ # Option A: store in .env (auto-loaded)
119
+ echo 'ENV=simulation' >> .env
120
+
121
+ # Option B: export in your shell
122
+ export ENV=simulation
123
+ ```
124
+
125
+
126
+ 7. Expose MCP on your FastAPI app (common to both paths)
127
+ ```python
128
+ from fastapi import FastAPI
129
+ from veris_ai import veris
130
+
131
+ app = FastAPI(title="Mini CRM Lead Qualifier")
132
+
133
+ # ... your routes and business logic ...
134
+
135
+ # Enable MCP integration with HTTP transport
136
+ veris.set_fastapi_mcp(fastapi=app)
137
+
138
+ # Mount the MCP server with HTTP transport (recommended)
139
+ veris.fastapi_mcp.mount_http()
140
+ ```
141
+
142
+ 8. Choose ONE integration path
143
+
144
+ Option A — Decorators (branch: `veris_decorators`)
145
+ - Reference: https://github.com/veris-ai/mini_crm/tree/veris_decorators
146
+ - Docs: https://github.com/veris-ai/veris-python-sdk?tab=readme-ov-file#core-decorators
147
+ ```python
148
+ from veris_ai.tool_mock import veris
149
+
150
+ @function_tool
151
+ @veris.mock(mode="tool", expects_response=False)
152
+ def lookup_lead(ctx: RunContextWrapper[CRMRunContext], query: str) -> Optional[Dict[str, Any]]:
153
+ ...
154
+ # Repeat for other tools
155
+ ```
156
+
157
+ Option B — Instrumentor (branch: `veris_instrument`)
158
+ - Reference: https://github.com/veris-ai/mini_crm/tree/veris_instrument
159
+ - Docs: https://github.com/veris-ai/veris-python-sdk?tab=readme-ov-file#core-instrument
160
+ ```python
161
+ from veris_ai import Runner, VerisConfig
162
+ from veris_ai.models import ToolCallOptions
163
+
164
+ result = await Runner.run(
165
+ agent,
166
+ req.message,
167
+ context=context.context,
168
+ veris_config=VerisConfig(
169
+ tool_options={
170
+ "score_lead_industry": ToolCallOptions(response_expectation="none"),
171
+ "get_leads": ToolCallOptions(response_expectation="none"),
172
+ "lookup_lead": ToolCallOptions(response_expectation="none"),
173
+ "write_lead_update": ToolCallOptions(response_expectation="none"),
174
+ }
175
+ ),
176
+ )
177
+ ```
178
+
179
+ 9. Start the agent server from the repo root
180
+ ```bash
181
+ veris setup --app app.main:app --port 8000 --reload
182
+ ```
183
+ This will start up the FastAPI server and tunnel it to a public address through ngrok. The simulator server will connect to the public URL.
184
+
185
+
186
+ 10. Generate scenarios
187
+ ```bash
188
+ veris scenario generate \
189
+ --agent .veris/agent.json \
190
+ --model gpt-4o-2024-08-06 \
191
+ --variations-per-skeleton 2 \
192
+ --random-subset 2 \
193
+ --watch --save
194
+ ```
195
+ Saves generated scenarios to `.veris/scenarios/` and prints the `generation_id`.
196
+
197
+
198
+ 11. Launch a simulation.
199
+
200
+ No need to wait for the run to finish. You may safely break out of this command by pressing `Ctrl+C`, the simulation will continue to run in the background.
201
+ ```bash
202
+ veris sim launch --watch
203
+ ```
204
+ **Note the run id printed in the console.**
205
+
206
+ 12. (Optional) Kill a session or evaluation.
207
+
208
+ In the event of a run-on or stalling session or evaluation, you can kill each by their corresponding command.
209
+ ```bash
210
+ # Kill a simulation
211
+ veris sim kill <simulation_id>
212
+
213
+ # Kill an evaluation
214
+ veris sim eval-kill <eval_id>
215
+ ```
216
+
217
+ 13. Explore results
218
+
219
+ This may be done at any point in the simulation process.
220
+ ```bash
221
+ veris sim results --run <run_id>
222
+ ```
223
+ 14. Congratulations!
224
+ You have now run simulations against your agent with no stateful side effects, observe no changes in the database!
225
+
226
+ ## Simulation commands
227
+
228
+ ### Launch simulations from `.veris/`
229
+
230
+ ```
231
+ veris sim launch [--scenarios <id> ...] [--use-cases <name> ...] [--watch]
232
+ ```
233
+
234
+ - `--watch` (optional) watches the status of the simulations and evaluations and updates the status in real-time untill all simulations are finished.
235
+ - Press Ctrl+C to stop watching; the command also auto-exits when all simulations and evaluations complete.
236
+
237
+ ### Check status (single poll)
238
+
239
+ ```
240
+ veris sim status --run <run_id>
241
+ ```
242
+
243
+ ### Stop a simulation or evaluation
244
+
245
+ ```
246
+ veris sim kill <simulation_id>
247
+ veris sim eval-kill <eval_id>
248
+ ```
249
+
250
+ Core flow mirrors the web demo launcher and monitor.
251
+
252
+ ### Show evaluation results
253
+
254
+ ```
255
+ veris sim results --run <run_id> [--json] [--export <path>]
256
+ ```
257
+
258
+ - Requires the run to be complete (all simulations evaluated). If not complete, the command exits with a helpful message; run `veris sim status --run <id>` until done.
259
+ - Default output is a simple table summarizing per-scenario and overall averages (`--table` is on by default).
260
+ - When `--json` is provided, emits a machine-readable summary; `--export` writes the same JSON to a file.
261
+
262
+ ## Scenario generation commands
263
+
264
+ ### Start generation
265
+
266
+ ```
267
+ veris scenario generate \
268
+ [--agent .veris/agent.json] \
269
+ [--config generator_config.json] \
270
+ [--model MODEL] \
271
+ [--variations-per-skeleton N] \
272
+ [--random-subset N] \
273
+ [--max-parallel-calls N] \
274
+ [--max-retries N] \
275
+ [--watch] [--save]
276
+ ```
277
+
278
+ - **--agent**: path to agent spec (defaults to `.veris/agent.json` if present)
279
+ - **--config**: optional generator config JSON, CLI flags override fields
280
+ - **--watch**: poll status until complete; with `--save`, scenarios are written to `.veris/scenarios/`
281
+
282
+ ### Check generation status
283
+
284
+ ```
285
+ veris scenario status --gen <generation_id>
286
+ ```
287
+
288
+ ### Fetch scenarios for a generation
289
+
290
+ ```
291
+ veris scenario get --gen <generation_id> [--include-failed] [--save] [--out-dir DIR]
292
+ ```
293
+ - Default saves scenarios into `.veris/scenarios/`. Use `--out-dir` to change destination or disable saving and print JSON with `--save=false`.
294
+
295
+
296
+
297
+ ### Veris initialization
298
+
299
+ ```
300
+ veris init
301
+ ```
302
+
303
+ Creates the following structure:
304
+
305
+ ```
306
+ .veris/
307
+ agent.json
308
+ scenarios/
309
+ example-scenario.json
310
+ runs/
311
+ ```
312
+
313
+ Agent spec and scenarios are JSON, validated against local Pydantic models.
314
+
315
+ ### Architecture (CLI)
316
+
317
+ - `SimulationRunner` orchestrates launches and status/evaluation polling.
318
+ - `ApiClient` wraps calls to the Veris API using `VERIS_API_URL`.
319
+ - Runs persist under `.veris/runs/<run_id>.json`.
320
+
321
+ ### Configuration
322
+
323
+ - Config file lives at `.veris/config.json` (created by `veris init` or on first save)
324
+ - Keys:
325
+ - `api_key`: used as `X-API-Key` header for API calls
326
+ - `agent`: connection to your local agent (`agent_id`, `name`, `mcp_url`, `mcp_transport`, `timeout_seconds`)
327
+ - Api key must be set as an environment variable or in a `.env` file:
328
+ ```bash
329
+ export VERIS_API_KEY="<your-api-key>"
330
+ ```
331
+ You can obtain your API key from `https://simulator.veris.ai/`.
332
+ - Commands:
333
+ - Set public agent URL (originally set via `veris setup`):
334
+ ```
335
+ veris config public_url <url>
336
+ ```
337
+ - `veris setup` integration:
338
+ - Automatically writes the discovered ngrok URL to `.veris/config.json` (unless `--no_override_public_url`)
339
+
340
+ ### Expose local FastAPI via ngrok
341
+
342
+ Prerequisites:
343
+ - ngrok installed and authenticated (run `ngrok config add-authtoken <token>`)
344
+ - Refer to this guide to get setup: https://ngrok.com/docs/getting-started/
345
+ - To check if auth token is set, run `ngrok config check`
346
+ - uvicorn available in your FastAPI environment
347
+
348
+ Run your FastAPI app and expose it via ngrok:
349
+ ```
350
+ veris setup --app app.main:app --port 8000
351
+ ```
352
+
353
+ Common options:
354
+ - `--app`: ASGI import path, e.g. `app.main:app` (required)
355
+ - `--port`: Local port (default: 8000)
356
+ - `--host`: Bind host (default: 127.0.0.1)
357
+ - `--reload`: Enable auto-reload (dev only)
358
+ - `--workers`: Number of worker processes
359
+ - `-d`, `--detached`: Run in background and persist PIDs to `.veris/setup_state.json`
360
+ - Use `veris setup stop` to stop the detached process
361
+
362
+ Show help:
363
+ ```
364
+ veris setup --help
365
+ ```
366
+
367
+
368
+ ## Contributing
369
+
370
+ ### Development config
371
+
372
+ Override the API base URL by adding the following to your environment or `.env` file:
373
+
374
+ ```
375
+ export VERIS_API_URL=http://localhost:8742
376
+ ```
377
+
378
+ ### Development
379
+
380
+ Install development dependencies:
381
+ ```bash
382
+ # Install with all extras
383
+ uv sync --all-extras
384
+ ```
385
+
386
+ Run tests with coverage:
387
+ ```bash
388
+ uv run pytest tests/ --cov=veris_cli --cov-report=term-missing
389
+ ```
390
+
391
+ Run lints and format code:
392
+ ```bash
393
+ # Format code with uv (experimental feature)
394
+ uv format
395
+
396
+ # Check formatting without making changes
397
+ uv format --check
398
+
399
+ # Run all pre-commit hooks
400
+ uv run pre-commit run --all-files
401
+ ```
402
+
403
+ ### CI/CD
404
+
405
+ This project uses GitHub Actions for continuous integration and deployment:
406
+
407
+ #### Test Workflow
408
+ - **Trigger**: On push to main, pull requests, or manual dispatch
409
+ - **Matrix**: Tests against Python 3.11, 3.12, and 3.13
410
+ - **Checks**:
411
+ - Code formatting with `uv format --check`
412
+ - Unit tests with coverage reporting
413
+
414
+ #### Release Workflow
415
+ - **Trigger**: Manual workflow dispatch
416
+ - **Process**:
417
+ - Semantic versioning with conventional commits
418
+ - Automated changelog generation
419
+ - PyPI package publishing with `uv`
420
+
421
+ To release a new version:
422
+ 1. Ensure all changes are committed with conventional commit messages
423
+ 2. Go to Actions → Release → Run workflow
424
+ 3. The workflow will automatically:
425
+ - Bump version based on commits
426
+ - Update changelog
427
+ - Build and publish to PyPI