testzeus-cli 0.0.23__tar.gz → 0.0.26__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.
- testzeus_cli-0.0.23/README.md → testzeus_cli-0.0.26/PKG-INFO +81 -0
- testzeus_cli-0.0.23/PKG-INFO → testzeus_cli-0.0.26/README.md +51 -30
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/pyproject.toml +4 -4
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/cli.py +6 -0
- testzeus_cli-0.0.26/testzeus_cli/commands/agent_harness.py +259 -0
- testzeus_cli-0.0.26/testzeus_cli/commands/connected_environments.py +447 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/environments.py +93 -38
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/test_data.py +3 -18
- testzeus_cli-0.0.26/testzeus_cli/commands/test_report_runs.py +164 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/LICENSE +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/__init__.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/auth.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/__init__.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/daemon.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/device_pool.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/extensions.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/hypermind_code_blocks.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/knowledge_bases.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/notification_channels.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/tags.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/test_report_schedules.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/test_run_groups.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/test_runs.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/test_suite_node_runs.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/test_suite_runs.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/test_suite_schedules.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/test_suites.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/tests.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/tests_ai_generator.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/tests_authoring.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/commands/user_integrations.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/config.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/utils/__init__.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/utils/auth.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/utils/client.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/utils/files.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/utils/formatters.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/utils/links.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/utils/profile.py +0 -0
- {testzeus_cli-0.0.23 → testzeus_cli-0.0.26}/testzeus_cli/utils/validators.py +0 -0
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: testzeus-cli
|
|
3
|
+
Version: 0.0.26
|
|
4
|
+
Summary: Command-line interface for TestZeus testing platform
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Author: Shriyansh Agnihotri
|
|
7
|
+
Author-email: shriyansh@testzeus.com
|
|
8
|
+
Requires-Python: >=3.11,<3.14
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Provides-Extra: daemon
|
|
15
|
+
Requires-Dist: Pygments (==2.20.0)
|
|
16
|
+
Requires-Dist: aiohttp (>=3.14.1,<4.0.0)
|
|
17
|
+
Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
18
|
+
Requires-Dist: cryptography (>=48.0.1,<49.0.0)
|
|
19
|
+
Requires-Dist: ipdb (>=0.13.13,<0.14.0)
|
|
20
|
+
Requires-Dist: keyring (>=24.0.0,<25.0.0)
|
|
21
|
+
Requires-Dist: pocketbase (>=0.15.0,<0.16.0)
|
|
22
|
+
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
|
23
|
+
Requires-Dist: pyyaml (>=6.0,<7.0)
|
|
24
|
+
Requires-Dist: rich (>=13.3.1,<14.0.0)
|
|
25
|
+
Requires-Dist: testzeus-sdk (>=0.0.24,<0.1.0)
|
|
26
|
+
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
|
27
|
+
Project-URL: Repository, https://github.com/test-zeus-ai/testzeus-cli
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
1
30
|
# TestZeus CLI
|
|
2
31
|
|
|
3
32
|
A powerful command-line interface for the TestZeus testing platform.
|
|
@@ -937,6 +966,57 @@ testzeus tests-authoring manual --name my_test --feature "Feature: Login..."
|
|
|
937
966
|
|
|
938
967
|
See `testzeus_cli/commands/tests_authoring.py` for implementation.
|
|
939
968
|
|
|
969
|
+
## Agent Harness
|
|
970
|
+
|
|
971
|
+
Adversarial testing of AI agents (Salesforce Agentforce). List agents, list or
|
|
972
|
+
generate adversarial pathways, run simulations, and monitor / cancel them. Sits
|
|
973
|
+
on the `client.agent_harness` SDK manager.
|
|
974
|
+
|
|
975
|
+
### List Agents
|
|
976
|
+
|
|
977
|
+
```bash
|
|
978
|
+
testzeus agent-harness list-agents
|
|
979
|
+
testzeus agent-harness list-agents --status active --search billing
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
### Get Agent Details
|
|
983
|
+
|
|
984
|
+
```bash
|
|
985
|
+
testzeus agent-harness get-agent <agent_id>
|
|
986
|
+
```
|
|
987
|
+
|
|
988
|
+
### Pathways
|
|
989
|
+
|
|
990
|
+
```bash
|
|
991
|
+
# List adversarial pathways for an agent
|
|
992
|
+
testzeus agent-harness list-pathways <agent_id>
|
|
993
|
+
|
|
994
|
+
# Start an AI pathway-generation job for a Salesforce agent profile
|
|
995
|
+
testzeus agent-harness generate-pathways <agent_profile> --prompt "probe for PII leaks" --num 5
|
|
996
|
+
|
|
997
|
+
# Soft-delete a pathway
|
|
998
|
+
testzeus agent-harness delete-pathway <pathway_id>
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
### Run Simulations
|
|
1002
|
+
|
|
1003
|
+
```bash
|
|
1004
|
+
# Start a run over one or more pathways
|
|
1005
|
+
testzeus agent-harness run <agent_id> --pathway <pathway_id> --pathway <pathway_id>
|
|
1006
|
+
|
|
1007
|
+
# Run and wait for it to finish (polls status)
|
|
1008
|
+
testzeus agent-harness run <agent_id> --pathway <pathway_id> --wait --timeout 1800
|
|
1009
|
+
```
|
|
1010
|
+
|
|
1011
|
+
### Monitor and Cancel
|
|
1012
|
+
|
|
1013
|
+
```bash
|
|
1014
|
+
testzeus agent-harness status <group_id>
|
|
1015
|
+
testzeus agent-harness cancel <group_id>
|
|
1016
|
+
```
|
|
1017
|
+
|
|
1018
|
+
See `testzeus_cli/commands/agent_harness.py` for implementation.
|
|
1019
|
+
|
|
940
1020
|
## Configuration
|
|
941
1021
|
|
|
942
1022
|
The CLI stores configuration and credentials in your user's config directory. Different profiles can be used to manage multiple TestZeus environments.
|
|
@@ -1090,3 +1170,4 @@ The TestZeus CLI uses GitHub Actions for automated releases to PyPI. To create a
|
|
|
1090
1170
|
- Commit and create a git tag
|
|
1091
1171
|
- Push changes and tags to GitHub
|
|
1092
1172
|
3. The tag push will automatically trigger the GitHub Actions publish workflow
|
|
1173
|
+
|
|
@@ -1,32 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: testzeus-cli
|
|
3
|
-
Version: 0.0.23
|
|
4
|
-
Summary: Command-line interface for TestZeus testing platform
|
|
5
|
-
License-File: LICENSE
|
|
6
|
-
Author: Shriyansh Agnihotri
|
|
7
|
-
Author-email: shriyansh@testzeus.com
|
|
8
|
-
Requires-Python: >=3.11,<3.14
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
-
Provides-Extra: daemon
|
|
15
|
-
Requires-Dist: Pygments (==2.20.0)
|
|
16
|
-
Requires-Dist: aiohttp (==3.13.4)
|
|
17
|
-
Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
18
|
-
Requires-Dist: cryptography (==46.0.7)
|
|
19
|
-
Requires-Dist: ipdb (>=0.13.13,<0.14.0)
|
|
20
|
-
Requires-Dist: keyring (>=24.0.0,<25.0.0)
|
|
21
|
-
Requires-Dist: pocketbase (>=0.15.0,<0.16.0)
|
|
22
|
-
Requires-Dist: pydantic (>=2.0.0,<3.0.0)
|
|
23
|
-
Requires-Dist: pyyaml (>=6.0,<7.0)
|
|
24
|
-
Requires-Dist: rich (>=13.3.1,<14.0.0)
|
|
25
|
-
Requires-Dist: testzeus-sdk (>=0.0.19,<0.1.0)
|
|
26
|
-
Requires-Dist: toml (>=0.10.2,<0.11.0)
|
|
27
|
-
Project-URL: Repository, https://github.com/test-zeus-ai/testzeus-cli
|
|
28
|
-
Description-Content-Type: text/markdown
|
|
29
|
-
|
|
30
1
|
# TestZeus CLI
|
|
31
2
|
|
|
32
3
|
A powerful command-line interface for the TestZeus testing platform.
|
|
@@ -966,6 +937,57 @@ testzeus tests-authoring manual --name my_test --feature "Feature: Login..."
|
|
|
966
937
|
|
|
967
938
|
See `testzeus_cli/commands/tests_authoring.py` for implementation.
|
|
968
939
|
|
|
940
|
+
## Agent Harness
|
|
941
|
+
|
|
942
|
+
Adversarial testing of AI agents (Salesforce Agentforce). List agents, list or
|
|
943
|
+
generate adversarial pathways, run simulations, and monitor / cancel them. Sits
|
|
944
|
+
on the `client.agent_harness` SDK manager.
|
|
945
|
+
|
|
946
|
+
### List Agents
|
|
947
|
+
|
|
948
|
+
```bash
|
|
949
|
+
testzeus agent-harness list-agents
|
|
950
|
+
testzeus agent-harness list-agents --status active --search billing
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
### Get Agent Details
|
|
954
|
+
|
|
955
|
+
```bash
|
|
956
|
+
testzeus agent-harness get-agent <agent_id>
|
|
957
|
+
```
|
|
958
|
+
|
|
959
|
+
### Pathways
|
|
960
|
+
|
|
961
|
+
```bash
|
|
962
|
+
# List adversarial pathways for an agent
|
|
963
|
+
testzeus agent-harness list-pathways <agent_id>
|
|
964
|
+
|
|
965
|
+
# Start an AI pathway-generation job for a Salesforce agent profile
|
|
966
|
+
testzeus agent-harness generate-pathways <agent_profile> --prompt "probe for PII leaks" --num 5
|
|
967
|
+
|
|
968
|
+
# Soft-delete a pathway
|
|
969
|
+
testzeus agent-harness delete-pathway <pathway_id>
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
### Run Simulations
|
|
973
|
+
|
|
974
|
+
```bash
|
|
975
|
+
# Start a run over one or more pathways
|
|
976
|
+
testzeus agent-harness run <agent_id> --pathway <pathway_id> --pathway <pathway_id>
|
|
977
|
+
|
|
978
|
+
# Run and wait for it to finish (polls status)
|
|
979
|
+
testzeus agent-harness run <agent_id> --pathway <pathway_id> --wait --timeout 1800
|
|
980
|
+
```
|
|
981
|
+
|
|
982
|
+
### Monitor and Cancel
|
|
983
|
+
|
|
984
|
+
```bash
|
|
985
|
+
testzeus agent-harness status <group_id>
|
|
986
|
+
testzeus agent-harness cancel <group_id>
|
|
987
|
+
```
|
|
988
|
+
|
|
989
|
+
See `testzeus_cli/commands/agent_harness.py` for implementation.
|
|
990
|
+
|
|
969
991
|
## Configuration
|
|
970
992
|
|
|
971
993
|
The CLI stores configuration and credentials in your user's config directory. Different profiles can be used to manage multiple TestZeus environments.
|
|
@@ -1119,4 +1141,3 @@ The TestZeus CLI uses GitHub Actions for automated releases to PyPI. To create a
|
|
|
1119
1141
|
- Commit and create a git tag
|
|
1120
1142
|
- Push changes and tags to GitHub
|
|
1121
1143
|
3. The tag push will automatically trigger the GitHub Actions publish workflow
|
|
1122
|
-
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "testzeus-cli"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.26"
|
|
8
8
|
description = "Command-line interface for TestZeus testing platform"
|
|
9
9
|
authors = ["Shriyansh Agnihotri <shriyansh@testzeus.com>"]
|
|
10
10
|
readme = "README.md"
|
|
@@ -22,12 +22,12 @@ pydantic = "^2.0.0"
|
|
|
22
22
|
pyyaml = "^6.0"
|
|
23
23
|
keyring = "^24.0.0"
|
|
24
24
|
ipdb = "^0.13.13"
|
|
25
|
-
testzeus-sdk = ">=0.0.
|
|
25
|
+
testzeus-sdk = ">=0.0.24,<0.1.0"
|
|
26
26
|
pocketbase = "^0.15.0"
|
|
27
27
|
toml = "^0.10.2"
|
|
28
|
-
aiohttp = "3.
|
|
28
|
+
aiohttp = "^3.14.1"
|
|
29
29
|
Pygments = "2.20.0"
|
|
30
|
-
cryptography = "
|
|
30
|
+
cryptography = "^48.0.1"
|
|
31
31
|
|
|
32
32
|
[tool.poetry.extras]
|
|
33
33
|
daemon = [
|
|
@@ -27,7 +27,9 @@ from testzeus_cli.commands.test_data import test_data_group
|
|
|
27
27
|
from testzeus_cli.commands.tags import tags_group
|
|
28
28
|
from testzeus_cli.commands.device_pool import device_pool_group
|
|
29
29
|
from testzeus_cli.commands.environments import environments_group
|
|
30
|
+
from testzeus_cli.commands.connected_environments import connected_environments_group
|
|
30
31
|
from testzeus_cli.commands.test_report_schedules import test_report_schedules_group
|
|
32
|
+
from testzeus_cli.commands.test_report_runs import test_report_runs_group
|
|
31
33
|
from testzeus_cli.commands.notification_channels import notification_channels_group
|
|
32
34
|
from testzeus_cli.commands.extensions import extensions_group
|
|
33
35
|
from testzeus_cli.commands.tests_ai_generator import tests_ai_generator_group
|
|
@@ -35,6 +37,7 @@ from testzeus_cli.commands.hypermind_code_blocks import hypermind_code_blocks_gr
|
|
|
35
37
|
from testzeus_cli.commands.user_integrations import user_integrations_group
|
|
36
38
|
from testzeus_cli.commands.tests_authoring import tests_authoring_group
|
|
37
39
|
from testzeus_cli.commands.knowledge_bases import knowledge_bases_group
|
|
40
|
+
from testzeus_cli.commands.agent_harness import agent_harness_group
|
|
38
41
|
|
|
39
42
|
# Daemon dependencies (fastapi/uvicorn/sse-starlette) are optional extras.
|
|
40
43
|
# Keep CLI core commands (e.g. session-exchange) functional when extras are absent.
|
|
@@ -92,7 +95,9 @@ cli.add_command(test_data_group)
|
|
|
92
95
|
cli.add_command(tags_group)
|
|
93
96
|
cli.add_command(device_pool_group)
|
|
94
97
|
cli.add_command(environments_group)
|
|
98
|
+
cli.add_command(connected_environments_group)
|
|
95
99
|
cli.add_command(test_report_schedules_group)
|
|
100
|
+
cli.add_command(test_report_runs_group)
|
|
96
101
|
cli.add_command(notification_channels_group)
|
|
97
102
|
cli.add_command(extensions_group)
|
|
98
103
|
cli.add_command(tests_ai_generator_group)
|
|
@@ -100,6 +105,7 @@ cli.add_command(hypermind_code_blocks_group)
|
|
|
100
105
|
cli.add_command(user_integrations_group)
|
|
101
106
|
cli.add_command(tests_authoring_group)
|
|
102
107
|
cli.add_command(knowledge_bases_group)
|
|
108
|
+
cli.add_command(agent_harness_group)
|
|
103
109
|
if daemon_command is not None:
|
|
104
110
|
cli.add_command(daemon_command)
|
|
105
111
|
# New command groups can be added here when implemented
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agent Harness commands for TestZeus CLI.
|
|
3
|
+
|
|
4
|
+
Adversarial testing of AI agents (Salesforce Agentforce): list agents, list or
|
|
5
|
+
generate adversarial pathways, run simulations, and monitor / cancel them.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import asyncio
|
|
9
|
+
import click
|
|
10
|
+
from rich.console import Console
|
|
11
|
+
from testzeus_sdk import TestZeusClient
|
|
12
|
+
from testzeus_cli.config import get_client_config
|
|
13
|
+
from testzeus_cli.utils.formatters import format_output, print_message
|
|
14
|
+
from testzeus_cli.utils.auth import initialize_client_with_token
|
|
15
|
+
from testzeus_cli.utils.validators import validate_id
|
|
16
|
+
from testzeus_cli.utils.links import print_platform_link
|
|
17
|
+
|
|
18
|
+
console = Console()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _client(ctx):
|
|
22
|
+
"""Build the config + client tuple used by every command."""
|
|
23
|
+
config, token, tenant_id, user_id = get_client_config(ctx.obj["PROFILE"], api_url=ctx.obj.get("API_URL"))
|
|
24
|
+
return TestZeusClient(**config), token, tenant_id, user_id
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
async def _auth(client, token):
|
|
28
|
+
if token:
|
|
29
|
+
initialize_client_with_token(client, token)
|
|
30
|
+
else:
|
|
31
|
+
await client.ensure_authenticated()
|
|
32
|
+
if not hasattr(client, "agent_harness"):
|
|
33
|
+
raise click.ClickException("Agent Harness needs a newer testzeus-sdk. Upgrade with: pip install -U testzeus-sdk")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@click.group(name="agent-harness")
|
|
37
|
+
def agent_harness_group():
|
|
38
|
+
"""Adversarial testing of AI agents (Agent Harness)"""
|
|
39
|
+
pass
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@agent_harness_group.command(name="list-agents")
|
|
43
|
+
@click.option("--page", default=1, help="Page number")
|
|
44
|
+
@click.option("--per-page", default=50, help="Results per page")
|
|
45
|
+
@click.option("--status", help="Filter by status")
|
|
46
|
+
@click.option("--search", help="Search term")
|
|
47
|
+
@click.pass_context
|
|
48
|
+
def list_agents(ctx, page, per_page, status, search):
|
|
49
|
+
"""List available agents"""
|
|
50
|
+
|
|
51
|
+
async def _run():
|
|
52
|
+
client, token, _, _ = _client(ctx)
|
|
53
|
+
async with client:
|
|
54
|
+
await _auth(client, token)
|
|
55
|
+
return await client.agent_harness.list_agents(page=page, per_page=per_page, status=status, search=search)
|
|
56
|
+
|
|
57
|
+
try:
|
|
58
|
+
print_platform_link(ctx, "agent-harness")
|
|
59
|
+
format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
|
|
60
|
+
except Exception as e:
|
|
61
|
+
print_message(f"[red]Error listing agents: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
62
|
+
raise click.Abort()
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@agent_harness_group.command(name="list-pathways")
|
|
66
|
+
@click.argument("agent_id")
|
|
67
|
+
@click.option("--page", default=1, help="Page number")
|
|
68
|
+
@click.option("--per-page", default=50, help="Results per page")
|
|
69
|
+
@click.pass_context
|
|
70
|
+
def list_pathways(ctx, agent_id, page, per_page):
|
|
71
|
+
"""List adversarial pathways for an agent"""
|
|
72
|
+
|
|
73
|
+
# NOTE: unlike the generic `list` commands (which take --filters/-f + --sort),
|
|
74
|
+
# pathways are always scoped to a single agent, so this takes an agent_id
|
|
75
|
+
# argument instead. The SDK builds the agent_id filter via the shared filter
|
|
76
|
+
# builder; add --filters/--sort here if the manager grows to support them.
|
|
77
|
+
async def _run():
|
|
78
|
+
client, token, _, _ = _client(ctx)
|
|
79
|
+
async with client:
|
|
80
|
+
await _auth(client, token)
|
|
81
|
+
agent = validate_id(agent_id, "agent")
|
|
82
|
+
res = await client.agent_harness.list_pathways(agent_id=agent, page=page, per_page=per_page)
|
|
83
|
+
# get_list returns AdversaryPathways models; unwrap to dicts for output.
|
|
84
|
+
res["items"] = [p.data for p in res.get("items", [])]
|
|
85
|
+
return res
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
print_platform_link(ctx, "agent-harness")
|
|
89
|
+
format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
|
|
90
|
+
except Exception as e:
|
|
91
|
+
print_message(f"[red]Error listing pathways: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
92
|
+
raise click.Abort()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@agent_harness_group.command(name="generate-pathways")
|
|
96
|
+
@click.argument("agent_profile")
|
|
97
|
+
@click.option("--prompt", required=True, help="Directional prompt for pathway generation")
|
|
98
|
+
@click.option("--name", help="Generation job name (auto-generated if omitted)")
|
|
99
|
+
@click.option("--agent-name", help="Agent display name")
|
|
100
|
+
@click.option("--num", type=int, help="Number of pathways to generate")
|
|
101
|
+
@click.option("--allow-destructive", is_flag=True, default=False, help="Allow destructive scenarios")
|
|
102
|
+
@click.pass_context
|
|
103
|
+
def generate_pathways(ctx, agent_profile, prompt, name, agent_name, num, allow_destructive):
|
|
104
|
+
"""Start an AI pathway-generation job for a Salesforce agent profile"""
|
|
105
|
+
|
|
106
|
+
async def _run():
|
|
107
|
+
client, token, _, _ = _client(ctx)
|
|
108
|
+
async with client:
|
|
109
|
+
await _auth(client, token)
|
|
110
|
+
# tenant/created_by/modified_by are auto-filled by the SDK manager.
|
|
111
|
+
return await client.agent_harness.generate_pathways(
|
|
112
|
+
agent_profile=agent_profile,
|
|
113
|
+
directional_prompt=prompt,
|
|
114
|
+
name=name,
|
|
115
|
+
agent_name=agent_name,
|
|
116
|
+
num_pathways=num,
|
|
117
|
+
allow_destructive=allow_destructive,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
try:
|
|
121
|
+
result = asyncio.run(_run())
|
|
122
|
+
print_message("[green]Pathway generation started[/green]", ctx.obj["FORMAT"])
|
|
123
|
+
print_platform_link(ctx, "agent-harness")
|
|
124
|
+
format_output(result.data, ctx.obj["FORMAT"])
|
|
125
|
+
except Exception as e:
|
|
126
|
+
print_message(f"[red]Error generating pathways: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
127
|
+
raise click.Abort()
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@agent_harness_group.command(name="run")
|
|
131
|
+
@click.argument("agent_id")
|
|
132
|
+
@click.option("--pathway", "pathways", multiple=True, required=True, help="Pathway ID to run (repeatable)")
|
|
133
|
+
@click.option("--name", help="Run name (auto-generated if omitted)")
|
|
134
|
+
@click.option("--agent-name", help="Agent display name")
|
|
135
|
+
@click.option("--run-as-profile", help="Salesforce profile to run as (RBAC)")
|
|
136
|
+
@click.option("--wait", is_flag=True, default=False, help="Wait and poll until the run finishes")
|
|
137
|
+
@click.option("--timeout", default=1800.0, help="Max seconds to wait when --wait is set")
|
|
138
|
+
@click.pass_context
|
|
139
|
+
def run(ctx, agent_id, pathways, name, agent_name, run_as_profile, wait, timeout):
|
|
140
|
+
"""Run adversarial simulations for the given pathways"""
|
|
141
|
+
|
|
142
|
+
async def _run():
|
|
143
|
+
client, token, _, _ = _client(ctx)
|
|
144
|
+
async with client:
|
|
145
|
+
await _auth(client, token)
|
|
146
|
+
agent = validate_id(agent_id, "agent")
|
|
147
|
+
# tenant/created_by/modified_by are auto-filled by the SDK manager.
|
|
148
|
+
if wait:
|
|
149
|
+
return await client.agent_harness.run_and_wait(
|
|
150
|
+
agent,
|
|
151
|
+
list(pathways),
|
|
152
|
+
name=name,
|
|
153
|
+
agent_name=agent_name,
|
|
154
|
+
run_as_profile=run_as_profile,
|
|
155
|
+
timeout=timeout,
|
|
156
|
+
)
|
|
157
|
+
return await client.agent_harness.run(
|
|
158
|
+
agent,
|
|
159
|
+
list(pathways),
|
|
160
|
+
name=name,
|
|
161
|
+
agent_name=agent_name,
|
|
162
|
+
run_as_profile=run_as_profile,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
try:
|
|
166
|
+
result = asyncio.run(_run())
|
|
167
|
+
if not wait:
|
|
168
|
+
# run() returns an AdversaryPathwaysGroup model; run_and_wait returns a status dict.
|
|
169
|
+
group_id = result.id
|
|
170
|
+
print_message(
|
|
171
|
+
f"[green]Run started (group {group_id}). Poll with: testzeus agent-harness status {group_id}[/green]",
|
|
172
|
+
ctx.obj["FORMAT"],
|
|
173
|
+
)
|
|
174
|
+
print_platform_link(ctx, "agent-harness")
|
|
175
|
+
format_output(result.data, ctx.obj["FORMAT"])
|
|
176
|
+
else:
|
|
177
|
+
format_output(result, ctx.obj["FORMAT"])
|
|
178
|
+
except Exception as e:
|
|
179
|
+
print_message(f"[red]Error running simulations: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
180
|
+
raise click.Abort()
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@agent_harness_group.command(name="status")
|
|
184
|
+
@click.argument("group_id")
|
|
185
|
+
@click.pass_context
|
|
186
|
+
def status(ctx, group_id):
|
|
187
|
+
"""Get the status/results of a simulation run group"""
|
|
188
|
+
|
|
189
|
+
async def _run():
|
|
190
|
+
client, token, _, _ = _client(ctx)
|
|
191
|
+
async with client:
|
|
192
|
+
await _auth(client, token)
|
|
193
|
+
return await client.agent_harness.get_status(validate_id(group_id, "group"))
|
|
194
|
+
|
|
195
|
+
try:
|
|
196
|
+
format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
|
|
197
|
+
except Exception as e:
|
|
198
|
+
print_message(f"[red]Error getting status: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
199
|
+
raise click.Abort()
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@agent_harness_group.command(name="cancel")
|
|
203
|
+
@click.argument("group_id")
|
|
204
|
+
@click.pass_context
|
|
205
|
+
def cancel(ctx, group_id):
|
|
206
|
+
"""Cancel a running simulation group"""
|
|
207
|
+
|
|
208
|
+
async def _run():
|
|
209
|
+
client, token, _, _ = _client(ctx)
|
|
210
|
+
async with client:
|
|
211
|
+
await _auth(client, token)
|
|
212
|
+
return await client.agent_harness.cancel(validate_id(group_id, "group"))
|
|
213
|
+
|
|
214
|
+
try:
|
|
215
|
+
asyncio.run(_run())
|
|
216
|
+
print_message(f"[green]Cancelled simulation group {group_id}[/green]", ctx.obj["FORMAT"])
|
|
217
|
+
except Exception as e:
|
|
218
|
+
print_message(f"[red]Error cancelling group: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
219
|
+
raise click.Abort()
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@agent_harness_group.command(name="get-agent")
|
|
223
|
+
@click.argument("agent_id")
|
|
224
|
+
@click.pass_context
|
|
225
|
+
def get_agent(ctx, agent_id):
|
|
226
|
+
"""Get full detail for a single agent"""
|
|
227
|
+
|
|
228
|
+
async def _run():
|
|
229
|
+
client, token, _, _ = _client(ctx)
|
|
230
|
+
async with client:
|
|
231
|
+
await _auth(client, token)
|
|
232
|
+
return await client.agent_harness.get_agent(validate_id(agent_id, "agent"))
|
|
233
|
+
|
|
234
|
+
try:
|
|
235
|
+
print_platform_link(ctx, "agent-harness")
|
|
236
|
+
format_output(asyncio.run(_run()), ctx.obj["FORMAT"])
|
|
237
|
+
except Exception as e:
|
|
238
|
+
print_message(f"[red]Error getting agent: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
239
|
+
raise click.Abort()
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
@agent_harness_group.command(name="delete-pathway")
|
|
243
|
+
@click.argument("pathway_id")
|
|
244
|
+
@click.pass_context
|
|
245
|
+
def delete_pathway(ctx, pathway_id):
|
|
246
|
+
"""Soft-delete an adversarial pathway"""
|
|
247
|
+
|
|
248
|
+
async def _run():
|
|
249
|
+
client, token, _, _ = _client(ctx)
|
|
250
|
+
async with client:
|
|
251
|
+
await _auth(client, token)
|
|
252
|
+
return await client.agent_harness.delete_pathway(validate_id(pathway_id, "pathway"))
|
|
253
|
+
|
|
254
|
+
try:
|
|
255
|
+
asyncio.run(_run())
|
|
256
|
+
print_message(f"[green]Deleted pathway {pathway_id}[/green]", ctx.obj["FORMAT"])
|
|
257
|
+
except Exception as e:
|
|
258
|
+
print_message(f"[red]Error deleting pathway: {str(e)}[/red]", ctx.obj["FORMAT"])
|
|
259
|
+
raise click.Abort()
|