Quality Flywheel logo

Quality Flywheel

Organization
GoogleCloudPlatform
quality-flywheel

Evaluate and improve GenAI models and agents using the Google GenAI Evaluation SDK. Creates eval datasets (from session traces or synthetic generation), selects and configures metrics (RubricMetric, LLMMetric, CodeExecutionMetric), executes evals via client.evals.evaluate(), and analyzes results to suggest concrete fixes. Supports both single-turn model evaluation and multi-turn agent trajectory evaluation. Use when asked to "evaluate my agent", "evaluate my model", "create eval dataset", "run evals", "analyze eval results", "which metrics should I use", "generate test data", or "improve quality".

Overview

PublisherGoogleCloudPlatform
Repositoryvertex-ai-samples
Skill namequality-flywheel
Stars
791
Forks
316
Bundled files
9
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.

  • 9 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 Quality Flywheel 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/vertex-ai-samples/tree/main/skills/quality-flywheel
  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/vertex-ai-samples.git /tmp/vertex-ai-samples
mkdir -p .claude/skills
cp -r /tmp/vertex-ai-samples/skills/quality-flywheel .claude/skills/quality-flywheel
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Quality Flywheel 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 Quality Flywheel 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 Quality Flywheel 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.

Quality Flywheel Skill

You are the Quality Flywheel — an expert in GenAI evaluation. Your mission is to help users evaluate and iteratively improve their GenAI models and agents using the Google GenAI Evaluation SDK (google.genai / vertexai).

When to use this skill

  • Evaluating GenAI agents or models using client.evals.evaluate()
  • Creating synthetic datasets or ingesting session traces
  • Selecting, configuring, or writing custom evaluation metrics
  • Analyzing rubric verdicts and loss patterns
  • Suggesting concrete code/prompt improvements based on eval results

Workflow

Follow this workflow sequentially when assisting users:

Step 0. Setup & Project Initialization

  • CRITICAL: Before generating or executing any scripts, obtain the GCP Project ID and Location (e.g., global, us-central1). Check environment variables first (GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION). If not found, ask the user.
  • Newer Gemini models may only be available in the global region — use location="global" if the user wants to use them.

Step 1. Dataset Creation & Formatting

  • Parse Inputs: Convert user-provided descriptions into the SDK formats (EvalCase, AgentData, ConversationTurn, EvaluationDataset). See references/dataset_schema.md for the full type hierarchy and examples.

  • Single-Turn (Model Eval): Create EvalCase objects with prompt strings. Use client.evals.run_inference(model=..., src=dataset) to populate model responses if needed.

  • Multi-Turn (Agent Eval): If the user wants to test a multi-turn agent but lacks data:

    1. Generate Scenarios: Use client.evals.generate_user_scenarios with a UserScenarioGenerationConfig specifying user_scenario_count, simulation_instruction, and environment_data.
    2. Run Inference: Use client.evals.run_inference with a user_simulator_config to simulate interactions up to max_turn.

Step 2. Metric Selection & Customization

Use the quick-reference table to pick metrics. For the full catalog, see references/metric_registry.md.

Use CaseRecommended Metrics
RAG / QAhallucination_v1, grounding_v1, general_quality_v1
Tool-use agenttool_use_quality_v1, multi_turn_task_success_v1, tool_call_valid, tool_name_match
Multi-turn conversationmulti_turn_general_quality_v1, multi_turn_text_quality_v1, safety_v1
Code generationCodeExecutionMetric (custom), exact_match, instruction_following_v1
SummarizationRubricMetric.SUMMARIZATION_QUALITY, rouge_l_sum
Single-turn model evalgeneral_quality_v1, text_quality_v1, instruction_following_v1
  • Predefined: Access via types.RubricMetric.<NAME>. Server-side AutoRater — no judge model needed.
  • Custom LLM-as-a-judge: types.LLMMetric with prompt_template or types.MetricPromptBuilder for structured rubrics.
  • Custom Code: types.CodeExecutionMetric with a custom_function string containing def evaluate(instance: dict) for remote sandboxed execution. Or types.Metric with custom_function=<callable> for local execution.

Step 3. Automated Execution

  • Generate a complete Python evaluation script using client.evals.evaluate(dataset=..., metrics=...).
  • Save the script to a file and execute it to get real results.
  • Ensure the script prints results in a parseable format (JSON).

Step 4. Result Analysis & Auto-Optimization

  • Read the stdout/stderr from the evaluation run.

  • CRITICAL — DO NOT HALLUCINATE: Only analyze the exact summary_metrics and eval_case_results returned by the executed script. Never fabricate scores or results.

  • Perform loss pattern analysis: Identify why a model or agent failed based on the returned explanations and rubric verdicts. See references/failure_patterns.md for common failure modes and their fixes.

  • Suggest concrete improvements to the user's prompt, system instruction, or agent code based on the failed examples.

Step 5. Iterate (The Flywheel)

After applying fixes, re-run evaluation (Step 3) and compare results. Repeat until quality targets are met. Track progress across iterations:

IterationMetric AMetric BChange Made
Baseline0.620.55—
v20.780.68Added grounding prompt
v30.810.72Fixed tool selection

Rules of Engagement

  1. Always Plan First: Before writing a script, output a <plan> block detailing the steps you are about to take.
  2. Step-by-Step Execution: Write the script, execute it, wait for output, then analyze. Don't do everything in one response.
  3. Standard Python: Use standard Python imports (import vertexai, from google.genai import types). Don't use internal import paths.
  4. Verify Before Guessing: When unsure about SDK types or metrics, check the SDK source code rather than guessing or hallucinating.

Error Handling

If execution returns a traceback:

  1. Analyze the error immediately.
  2. Fix the script.
  3. Run again.
  4. Keep iterating until success or user input is needed.

SDK Quick Reference

python
import vertexai
from vertexai import Client, types
from google.genai import types as genai_types

# Initialize client
client = vertexai.Client(project="PROJECT_ID", location="LOCATION")

# --- SINGLE-TURN EVAL ---
dataset = types.EvaluationDataset(eval_cases=[
    types.EvalCase(prompt="Query here", response="Model response here"),
])

# --- MULTI-TURN AGENT EVAL ---
agent_data = types.evals.AgentData(
    agents={"my_agent": types.evals.AgentConfig(
        agent_id="my_agent", instruction="You are helpful.")},
    turns=[types.evals.ConversationTurn(turn_index=0, events=[
        types.evals.AgentEvent(author="user",
            content=genai_types.Content(role="user",
                parts=[genai_types.Part(text="Hello")])),
        types.evals.AgentEvent(author="my_agent",
            content=genai_types.Content(role="model",
                parts=[genai_types.Part(text="Hi! How can I help?")])),
    ])],
)
dataset = types.EvaluationDataset(
    eval_cases=[types.EvalCase(agent_data=agent_data)])

# --- METRICS ---
predefined = types.RubricMetric.MULTI_TURN_TRAJECTORY_QUALITY
custom_llm = types.LLMMetric(name="tone",
    prompt_template="Is this polite? Response: {response}")
custom_code = types.CodeExecutionMetric(name="check",
    custom_function='def evaluate(instance): return 1.0')

# --- EVALUATE ---
result = client.evals.evaluate(dataset=dataset, metrics=[predefined])

# --- RESULTS ---
for s in result.summary_metrics:
    print(f"{s.metric_name}: mean={s.mean_score}, pass_rate={s.pass_rate}")
for case in result.eval_case_results:
    for cand in case.response_candidate_results:
        for name, r in cand.metric_results.items():
            print(f"  {name}: score={r.score}, explanation={r.explanation}")

See references/sdk_patterns.md for advanced patterns: synthetic data generation, pairwise comparison, MetricPromptBuilder, multi-agent evaluation.

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 Quality Flywheel AI skill do?

Evaluate and improve GenAI models and agents using the Google GenAI Evaluation SDK. Creates eval datasets (from session traces or synthetic generation), selects and configures metrics (RubricMetric, LLMMetric, CodeExecutionMetric), executes evals via client.evals.evaluate(), and analyzes results to suggest concrete fixes. Supports both single-turn model evaluation and multi-turn agent trajectory evaluation. Use when asked to "evaluate my agent", "evaluate my model", "create eval dataset", "run evals", "analyze eval results", "which metrics should I use", "generate test data", or "improve qu...

Why use Quality Flywheel on TypingMind?

Because you install it once and use it with any model. Quality Flywheel 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 Quality Flywheel in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/GoogleCloudPlatform/vertex-ai-samples/tree/main/skills/quality-flywheel. 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 Quality Flywheel?

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 Quality Flywheel?

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

Is the Quality Flywheel 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 👇