Cxas Loss Analysis logo

Cxas Loss Analysis

Organization
GoogleCloudPlatform
cxas-loss-analysis

Retrieves non-contained CCAI Insights conversations (losses), uses agent intelligence to cluster them into common failure patterns, and generates a markdown report. Use when you need to analyze failure patterns and build targeted regression/evaluation reports.

Overview

PublisherGoogleCloudPlatform
Repositorycxas-scrapi
Skill namecxas-loss-analysis
Stars
113
Forks
106
Bundled files
1
LicenseApache-2.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by GoogleCloudPlatform on GitHub. Read the source before you install it.

Installation

Install the Cxas Loss Analysis AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/GoogleCloudPlatform/cxas-scrapi/tree/main/.agents/skills/cxas-loss-analysis
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/GoogleCloudPlatform/cxas-scrapi.git /tmp/cxas-scrapi
mkdir -p .claude/skills
cp -r /tmp/cxas-scrapi/.agents/skills/cxas-loss-analysis .claude/skills/cxas-loss-analysis
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Cxas Loss Analysis in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Cxas Loss Analysis on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Cxas Loss Analysis is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Insights Loss Analysis & Report Generator

This skill instructs you (the AI Agent) to retrieve recent conversations from CCAI Insights, isolate escalated/non-contained sessions (losses), analyze their root causes to group them into failure patterns, and write a professional Markdown report.


Execution Routine

Follow these steps in exact sequence:

Step 1: Parameter Verification

Verify that the user has provided the following required parameters:

  • project_id: GCP Project ID hosting Insights.
  • location: Insights location (e.g., us).
  • app_id: Target CXAS App ID (e.g., db9ee866-28db-458b-b835-78137c974779).
  • output_dir: Directory where the final report and test cases will be saved.

And the following optional parameters if they wish to scope the analysis:

  • start_time: RFC 3339 timestamp for start of time period (e.g., 2026-05-20T00:00:00Z).
  • end_time: RFC 3339 timestamp for end of time period (e.g., 2026-05-26T23:59:59Z).
  • filter: Custom API filter string to apply (overrides the default loss filter -labels.sessionContained="true").
  • limit: Maximum conversations to retrieve and process (default: 500).

Step 2: Extract Loss Transcripts

Run the lightweight data-extraction script to dump the loss transcripts into chunked JSON files in your workspace.

Command Template:

bash
python3 -P .agents/skills/cxas-loss-analysis/scripts/fetch_losses.py \
  --project-id "{project_id}" \
  --location "{location}" \
  --app-id "{app_id}" \
  --limit {limit} \
  --output-file "{output_dir}/raw_losses.json" \
  [--start-time "{start_time}"] \
  [--end-time "{end_time}"] \
  [--filter "{filter}"]

Note: Always run python using the virtual environment's executable with the -P flag (e.g., .venv/bin/python -P) to avoid path pollution.

Step 3: Read Transcripts & Summarize Escalations

Use the view_file or other file-reading tools to read the generated {output_dir}/raw_losses.json file. Extract the list of chunks (which contains paths to the chunked JSON files).

For each chunk file in the chunks list:

  1. Read the chunk file to load the batch of transcripts.
  2. For each conversation transcript: a. Analyze the conversation between the customer (user) and the virtual agent (agent). b. Identify if the user displayed "AI aversion":
    • Definition: Sessions where the user did not meaningfully engage with the agent or expressed a strong preference for a human agent (e.g., immediately asking for "human", "agent", "representative" in the first 1-2 turns without describing their issue, or explicitly stating they do not want to talk to an AI/robot).
    • If "AI aversion" is detected, mark this session as ignored from the core loss analysis. Note the reason (e.g., "AI aversion: User demanded human agent immediately"). c. For non-ignored genuine losses:
    • Identify why the conversation escalated or was not contained.
    • Formulate a concise, 1-sentence primary reason for failure/escalation (max 20 words). E.g., "Virtual agent failed to authenticate the user due to repeated pin entry errors."

Step 4: Cluster Failures into Loss Patterns

Review the complete list of genuine (non-ignored) failure reasons you generated in Step 3. Using your analytical capabilities, group these failure reasons into 8 to 10 distinct, mutually exclusive failure patterns to provide granular insights.

For each pattern, define:

  1. Pattern ID: A simple key (e.g., pattern_1, pattern_2, ...).
  2. Name: A short, descriptive name (e.g., "Authentication Loop", "Unsupported Customer Intent", "Agent Transfer on Disambiguation").
  3. Description: A clear 1-2 sentence description explaining the pattern and what triggers it.

Step 5: Categorize All Sessions

Map every analyzed conversation_id to either:

  • One of the 8 to 10 defined failure patterns.
  • ignored_ai_aversion if the user displayed AI aversion.

Keep track of this mapping for the final report.

Step 6: Write the Markdown Report

Compile your analysis into a structured Markdown report and write it to {output_dir}/loss_patterns_report.md. Use the following structure:

markdown
# Loss Patterns Analysis Report

**Project**: `{project_id}`
**App ID**: `{app_id}`

## Executive Summary

A sample of up to {limit} conversations matching the filter was selected for detailed manual analysis and clustering to identify key patterns.

## Loss Patterns Distribution

| Pattern ID | Name | Count | Percentage of Genuine Losses |
| --- | --- | --- | --- |
| `pattern_1` | Pattern Name | Count | Pct% |
| ... | ... | ... | ... |

*Note: Ignored AI aversion sessions are excluded from the pattern distribution.*

## Detailed Patterns Breakdown

### `pattern_1`: Pattern Name

**Description**: Pattern description.
**Total Conversations**: Count

#### Examples & Failure Reasons:
- **Session `{conversation_id_1}`**: Failure reason from Step 3.
- **Session `{conversation_id_2}`**: Failure reason from Step 3.

---

## Appendix: Ignored Sessions (AI Aversion)
The following sessions were ignored from the pattern analysis because the user displayed AI aversion:
- **Session `{conversation_id_3}`**: AI aversion reason (e.g., *"User demanded human agent immediately"*).
- **Session `{conversation_id_4}`**: AI aversion reason.

Step 7: Present Summary to User

Present a clear summary of your findings directly in the chat, pointing the user to {output_dir}/loss_patterns_report.md and highlighting the key patterns and the adjusted containment rate.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Cxas Loss Analysis AI skill do?

Retrieves non-contained CCAI Insights conversations (losses), uses agent intelligence to cluster them into common failure patterns, and generates a markdown report. Use when you need to analyze failure patterns and build targeted regression/evaluation reports.

Why use Cxas Loss Analysis on TypingMind?

Because you install it once and use it with any model. Cxas Loss Analysis is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Cxas Loss Analysis in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/GoogleCloudPlatform/cxas-scrapi/tree/main/.agents/skills/cxas-loss-analysis. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Cxas Loss Analysis?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Cxas Loss Analysis?

As many as you like. As long as a model supports skills, you can use Cxas Loss Analysis with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Cxas Loss Analysis AI skill free?

Yes. It is published on GitHub by GoogleCloudPlatform under the Apache-2.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇