$npx -y skills add GoogleCloudPlatform/cxas-scrapi --skill cxas-sim-evalConverts CXAS golden evaluations to SCRAPI SimulationEvals test cases. Use when generating high-level, goal-oriented test cases from turn-by-turn evaluation JSONs, and when enriching test expectations with inferred tool calls.
| 1 | # CXAS Evaluation to Simulation Converter |
| 2 | |
| 3 | This skill helps convert turn-by-turn CXAS golden evaluations into high-level, goal-oriented test cases for the SCRAPI `SimulationEvals` framework. It analyzes the agent's tools to enrich expectations with specific tool calls. |
| 4 | |
| 5 | ______________________________________________________________________ |
| 6 | |
| 7 | ## Steps |
| 8 | |
| 9 | ### 1. Check Environment |
| 10 | |
| 11 | Ensure `cxas_scrapi` is installed as a python package. You can check this by running: |
| 12 | |
| 13 | ```bash |
| 14 | python -c "import cxas_scrapi" |
| 15 | ``` |
| 16 | |
| 17 | Ensure `gcloud` is authenticated properly: |
| 18 | |
| 19 | ```bash |
| 20 | gcloud auth list |
| 21 | ``` |
| 22 | |
| 23 | If needed, login with: |
| 24 | |
| 25 | ```bash |
| 26 | gcloud auth login |
| 27 | ``` |
| 28 | |
| 29 | ### 2. Get App Name and Output Directory |
| 30 | |
| 31 | > [!IMPORTANT] |
| 32 | > You MUST ask the user for the full resource name of the app/agent (e.g., `projects/.../locations/.../apps/...`) and the base output directory before proceeding with any execution steps. |
| 33 | |
| 34 | Ask the user for these values. |
| 35 | |
| 36 | ### 3. Fetch Evaluations |
| 37 | |
| 38 | Fetch the list of evaluations using the CES API. Save each evaluation as a JSON file named after its display name under `[output_dir]/golden_evals/`. |
| 39 | |
| 40 | ### 4. Fetch Tool Schemas |
| 41 | |
| 42 | Fetch the full schemas for all tools available in the app and save them under `[output_dir]/tools/`. |
| 43 | |
| 44 | ### 5. Fetch Agent Tools Configuration |
| 45 | |
| 46 | Fetch the list of tools and toolsets used by the agent and save the configuration (e.g., to `[output_dir]/agent_tools.json`). |
| 47 | |
| 48 | ### 6. Convert Evaluations |
| 49 | |
| 50 | Run the conversion script (`convert_eval.py`) to process the fetched evaluations and save the converted test cases under `[output_dir]/sim_evals/`. |
| 51 | |
| 52 | ## Automation Scripts |
| 53 | |
| 54 | Three scripts are available to automate the process: |
| 55 | |
| 56 | ### 1. Fetch Evaluations and Agent Config |
| 57 | |
| 58 | `scripts/fetch_app_data.py` |
| 59 | |
| 60 | Fetches evaluations and the list of tools used by the agent from the CES API. |
| 61 | |
| 62 | Usage: |
| 63 | |
| 64 | ```bash |
| 65 | python .agents/skills/cxas-sim-eval/scripts/fetch_app_data.py \ |
| 66 | --app-name "projects/.../locations/.../apps/..." \ |
| 67 | --output-dir /path/to/output_directory |
| 68 | ``` |
| 69 | |
| 70 | ### 2. Fetch Tool Schemas |
| 71 | |
| 72 | `scripts/fetch_tool_schemas.py` |
| 73 | |
| 74 | Fetches the full schemas for all tools available in the app. |
| 75 | |
| 76 | Usage: |
| 77 | |
| 78 | ```bash |
| 79 | python .agents/skills/cxas-sim-eval/scripts/fetch_tool_schemas.py \ |
| 80 | --app-name "projects/.../locations/.../apps/..." \ |
| 81 | --output-dir /path/to/output_directory |
| 82 | ``` |
| 83 | |
| 84 | ### 3. Convert Evaluations |
| 85 | |
| 86 | `scripts/convert_eval.py` |
| 87 | |
| 88 | Converts the fetched evaluations to simulation test cases, using the fetched tool schemas to infer expectations. |
| 89 | |
| 90 | Usage: |
| 91 | |
| 92 | ```bash |
| 93 | python .agents/skills/cxas-sim-eval/scripts/convert_eval.py \ |
| 94 | --output-dir /path/to/output_directory \ |
| 95 | --parallelism 5 |
| 96 | ``` |
| 97 | |
| 98 | ### 4. Run Evaluations |
| 99 | |
| 100 | `scripts/run_evals.py` |
| 101 | |
| 102 | Runs the simulation evaluations, logs raw results, and generates a combined HTML report. |
| 103 | |
| 104 | **Cognitive Diagnostics Analysis**: |
| 105 | If the agent has the `intercept_and_score_reasoning` tool enabled, this script will automatically extract and analyze the agent's internal monologue for failed evaluations. It detects issues like overthinking, hesitation, and backtracking. Furthermore, it correlates these diagnostics with the agent's instructions to generate **actionable suggestions** for improvement directly in the HTML report. |
| 106 | |
| 107 | Usage: |
| 108 | |
| 109 | ```bash |
| 110 | python .agents/skills/cxas-sim-eval/scripts/run_evals.py \ |
| 111 | --app-name "projects/.../locations/.../apps/..." \ |
| 112 | --output-dir /path/to/output_directory \ |
| 113 | --parallelism 5 \ |
| 114 | --start-index 0 \ |
| 115 | --end-index 10 |
| 116 | ``` |
| 117 | |
| 118 | ## Interpreting Cognitive Diagnostics |
| 119 | |
| 120 | When running evaluations with the `intercept_and_score_reasoning` tool enabled, the system extracts diagnostics to help you identify issues in agent reasoning. |
| 121 | |
| 122 | ### Key Signals |
| 123 | |
| 124 | 1. **Overthinking (Verbosity)** |
| 125 | |
| 126 | - **Symptom**: Internal monologue exceeds 350 or 600 characters. |
| 127 | - **Meaning**: The agent is struggling to process complex or circular instructions. |
| 128 | - **Fix**: Simplify instructions. Break down complex tasks into smaller, linear steps. |
| 129 | |
| 130 | 1. **Hedging** |
| 131 | |
| 132 | - **Symptom**: Use of words like "might be", "guess", "unsure", "assume". |
| 133 | - **Meaning**: The agent is uncertain about its next action, often due to missing edge case handling. |
| 134 | - **Fix**: Add explicit instructions for the scenario the agent is unsure about. |
| 135 | |
| 136 | 1. **Backtracking** |
| 137 | |
| 138 | - **Symptom**: Use of words like "wait", "actually", "on second thought". |
| 139 | - **Meaning**: The agent is abandoning a plan mid-turn or correcting itself, indicating unclear triggers. |
| 140 | - **Fix**: Clarify triggers and state transitions in instructions. |