You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update index.md
1. Updated the evaluation page, added the 4th evaluation "adk conformance", 2. removed numbering in headers as suggested, 3. improved the "notes" and "warnings" that had an incorrect formatting.
* Update index.md
* Update index.md
worked on all your comments
* Update index.md
Before automating agent evaluations, define clear objectives and success criteria:
18
18
@@ -22,16 +22,16 @@ Before automating agent evaluations, define clear objectives and success criteri
22
22
23
23
These considerations will guide the creation of evaluation scenarios and enable effective monitoring of agent behavior in real-world deployments.
24
24
25
-
## What to Evaluate?
25
+
## What to evaluate?
26
26
27
27
To bridge the gap between a proof-of-concept and a production-ready AI agent, a robust and automated evaluation framework is essential. Unlike evaluating generative models, where the focus is primarily on the final output, agent evaluation requires a deeper understanding of the decision-making process. Agent evaluation can be broken down into two components:
28
28
29
-
1.**Evaluating Trajectory and Tool Use:** Analyzing the steps an agent takes to reach a solution, including its choice of tools, strategies, and the efficiency of its approach.
30
-
2.**Evaluating the Final Response:** Assessing the quality, relevance, and correctness of the agent's final output.
29
+
1.**Evaluate Trajectory and Tool Use:** Analyzing the steps an agent takes to reach a solution, including its choice of tools, strategies, and the efficiency of its approach.
30
+
2.**Evaluate the Final Response:** Assessing the quality, relevance, and correctness of the agent's final output.
31
31
32
32
The trajectory is just a list of steps the agent took before it returned to the user. We can compare that against the list of steps we expect the agent to have taken.
33
33
34
-
### Evaluating trajectory and tool use
34
+
### Evaluate trajectory and tool use
35
35
36
36
Before responding to a user, an agent typically performs a series of actions, which we refer to as a 'trajectory.' It might compare the user input with session history to disambiguate a term, or lookup a policy document, search a knowledge base or invoke an API to save a ticket. We call this a ‘trajectory’ of actions. Evaluating an agent's performance requires comparing its actual trajectory to an expected, or ideal, one. This comparison can reveal errors and inefficiencies in the agent's process. The expected trajectory represents the ground truth \-- the list of steps we anticipate the agent should take.
ADK provides both groundtruth based and rubric based tool use evaluation metrics. To select the appropriate metric for your agent's specific requirements and goals, please refer to our [recommendations](#recommendations-on-criteria).
47
47
48
-
## How Evaluation works with the ADK
48
+
## How evaluation works with ADK
49
49
50
-
The ADK offers two methods for evaluating agent performance against predefined datasets and evaluation criteria. While conceptually similar, they differ in the amount of data they can process, which typically dictates the appropriate use case for each.
50
+
ADK offers two methods for evaluating agent performance against predefined datasets and evaluation criteria. While conceptually similar, they differ in the amount of data they can process, which typically dictates the appropriate use case for each.
51
51
52
-
### First approach: Using a test file
52
+
### Evaluate with test files
53
53
54
54
This approach involves creating individual test files, each representing a single, simple agent-model interaction (a session). It's most effective during active agent development, serving as a form of unit testing. These tests are designed for rapid execution and should focus on simple session complexity. Each test file contains a single session, which may consist of multiple turns. A turn represents a single interaction between the user and the agent. Each turn includes
55
55
@@ -70,7 +70,8 @@ You can give the file any name for example `evaluation.test.json`. The framework
*(Note: Comments are included for explanatory purposes and should be removed for the JSON to be valid.)*
73
+
!!! note
74
+
Comments are included for explanatory purposes and should be removed for the JSON to be valid.
74
75
75
76
```json
76
77
# Do note that some fields are removed for sake of making this doc readable.
@@ -129,7 +130,8 @@ Test files can be organized into folders. Optionally, a folder can also include
129
130
130
131
#### How to migrate test files not backed by the Pydantic schema?
131
132
132
-
NOTE: If your test files don't adhere to [EvalSet](https://github.com/google/adk-python/blob/main/src/google/adk/evaluation/eval_set.py) schema file, then this section is relevant to you.
133
+
!!! note
134
+
If your test files don't adhere to [EvalSet](https://github.com/google/adk-python/blob/main/src/google/adk/evaluation/eval_set.py) schema file, then this section is relevant to you.
133
135
134
136
Please use `AgentEvaluator.migrate_eval_data_to_new_schema` to migrate your
135
137
existing `*.test.json` files to the Pydantic backed schema.
@@ -139,7 +141,7 @@ file, and generates a single output json file with data serialized in the new
139
141
format. Given that the new schema is more cohesive, both the old test data file
140
142
and initial session file can be ignored (or removed.)
141
143
142
-
### Second approach: Using An Evalset File
144
+
### Evaluate with an Evalset File
143
145
144
146
The evalset approach utilizes a dedicated dataset called an "evalset" for evaluating agent-model interactions. Similar to a test file, the evalset contains example interactions. However, an evalset can contain multiple, potentially lengthy sessions, making it ideal for simulating complex, multi-turn conversations. Due to its ability to represent complex sessions, the evalset is well-suited for integration tests. These tests are typically run less frequently than unit tests due to their more extensive nature.
145
147
@@ -153,7 +155,8 @@ Creating evalsets manually can be complex, therefore UI tools are provided to he
153
155
This evalset evaluation method requires the use of a paid service,
154
156
[Vertex Gen AI Evaluation Service API](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/evaluation).
155
157
156
-
*(Note: Comments are included for explanatory purposes and should be removed for the JSON to be valid.)*
158
+
!!! note
159
+
Comments are included for explanatory purposes and should be removed for the JSON to be valid.
157
160
158
161
```json
159
162
# Do note that some fields are removed for sake of making this doc readable.
@@ -291,7 +294,8 @@ Creating evalsets manually can be complex, therefore UI tools are provided to he
291
294
292
295
#### How to migrate eval set files not backed by the Pydantic schema?
293
296
294
-
NOTE: If your eval set files don't adhere to [EvalSet](https://github.com/google/adk-python/blob/main/src/google/adk/evaluation/eval_set.py) schema file, then this section is relevant to you.
297
+
!!! note
298
+
If your eval set files don't adhere to [EvalSet](https://github.com/google/adk-python/blob/main/src/google/adk/evaluation/eval_set.py) schema file, then this section is relevant to you.
295
299
296
300
Based on who is maintaining the eval set data, there are two routes:
297
301
@@ -302,6 +306,69 @@ Based on who is maintaining the eval set data, there are two routes:
302
306
migration tool is in the works, until then the ADK eval CLI command will
303
307
continue to support data in the old format.
304
308
309
+
### Evaluate with conformance testing
310
+
311
+
`adk conformance test` command verifies that your AI agents behave consistently over time. It ensures that updates to your codebase or models don't introduce regressions by validating current agent outputs against baseline data.
312
+
313
+
#### Prerequisites and setup
314
+
315
+
Before the `adk conformance` command can execute meaningful regression testing, you must establish an optimal "golden baseline." Conformance testing operates by comparing live agent behavior against these previously recorded, verified interactions.
316
+
317
+
Follow this workflow to prepare your environment:
318
+
##### Create the Test Directory Hierarchy
319
+
320
+
Conformance tests rely on a strict file layout to automatically discover and map test cases.
321
+
Initialize your testing directory using the following structure:
322
+
323
+
```
324
+
tests
325
+
└── category_name/
326
+
└── test_case_name/
327
+
├── spec.yaml # Test case specification
328
+
├── generated-recordings.yaml # Baseline recorded interactions
329
+
└── generated-session.yaml # Baseline session data
330
+
331
+
```
332
+
333
+
!!! note
334
+
If your agent uses Server-Sent Events (SSE), the testing framework will additionally look for `generated-recordings-sse.yaml` and `generated-session-sse.yaml` within the same folder.
335
+
336
+
##### Define the test specification (spec.yaml)
337
+
338
+
In your target test folder, create a `spec.yaml` file. This file outlines the initial conditions, configurations, and user prompts that the agent will execute during the baseline recording and subsequent conformance runs. Ensure your file matches the following basic schema, this is an example only:
339
+
340
+
```
341
+
# Example spec.yaml for a Weather Agent name: "current_weather_check" description:
342
+
"Verifies the agent correctly identifies location and calls the weather tool."
343
+
user_prompts: - "What's the temperature in San Francisco right now?" expected_tools:
344
+
- "get_weather_api"
345
+
```
346
+
347
+
#### Automate the baseline
348
+
349
+
Because the background data (like LLM requests and tool calls) is complex, you shouldn't try to write or save the baseline files manually. Instead, let ADK generate them for you.
350
+
351
+
1. Start your ADK web server with the recording plugin turned on:
352
+
353
+
```shell
354
+
adk web -v --extra_plugins=google.adk.cli.plugins.recordings_plugin.RecordingsPlugin /path/to/agents
355
+
```
356
+
357
+
2. Next, open a new terminal window and tell ADK to create the baseline files based on your spec.yaml:
358
+
359
+
```shell
360
+
adk conformance create tests/category/test_name
361
+
```
362
+
363
+
This automatically runs the scenario, records all the interactions, and saves the generated-recordings.yaml and generated-session.yaml files exactly where they need to be.
364
+
365
+
Once these baseline files are locked in, your setup is complete, and the directory is ready to be targeted by `adk conformance` in either **Replay** or **Live** mode.
366
+
367
+
#### How it works
368
+
369
+
***Replay Mode (Default):** The tool runs your agent and compares its live LLM requests, responses, and tool calls directly against your previously recorded interactions to catch unexpected deviations.
370
+
***Live Mode:** Runs evaluation-based verification against active environments *(Note: This mode is a work in progress)*.
371
+
305
372
### Evaluation Criteria
306
373
307
374
ADK provides several built-in criteria for evaluating agent performance, ranging
@@ -398,15 +465,16 @@ generated by an AI model.
398
465
For details on how to set up an eval with user simulation, see
399
466
[User Simulation](./user-sim.md).
400
467
401
-
## How to run Evaluation with the ADK
468
+
## How to run Evaluation with ADK
402
469
403
470
As a developer, you can evaluate your agents using the ADK in the following ways:
404
471
405
-
1.**Web-based UI (**`adk web`**):** Evaluate agents interactively through a web-based interface.
406
-
2.**Programmatically (**`pytest`**)**: Integrate evaluation into your testing pipeline using `pytest` and test files.
407
-
3.**Command Line Interface (**`adk eval`**):** Run evaluations on an existing evaluation set file directly from the command line.
472
+
-**Web-based UI (**`adk web`**):** Evaluate agents interactively through a web-based interface.
473
+
-**Programmatically (**`pytest`**)**: Integrate evaluation into your testing pipeline using `pytest` and test files.
474
+
-**Command Line Interface (**`adk eval`**):** Run evaluations on an existing evaluation set file directly from the command line.
475
+
-**Conformance Testing** (**`adk conformance`**):** Execute automated tests against your baseline files to detect unexpected deviations or regressions.
408
476
409
-
### 1\.`adk web`\-Run Evaluations via the Web UI
477
+
### Run Evaluations via the Web UI
410
478
411
479
The web UI provides an interactive way to evaluate agents, generate evaluation datasets, and inspect agent behavior in detail.
412
480
@@ -447,7 +515,7 @@ After the run completes, you can analyze the results:
447
515
448
516
### Debugging with the Trace View
449
517
450
-
The ADK web UI includes a powerful **Trace** tab for debugging agent behavior. This feature is available for any agent session, not just during evaluation.
518
+
ADK web UI includes a powerful **Trace** tab for debugging agent behavior. This feature is available for any agent session, not just during evaluation.
451
519
452
520
The **Trace** tab provides a detailed and interactive way to inspect your agent's execution flow. Traces are automatically grouped by user message, making it easy to follow the chain of events.
453
521
@@ -465,7 +533,7 @@ Each trace row is interactive:
465
533
466
534
Blue rows in the trace view indicate that an event was generated from that interaction. Clicking on these blue rows will open the bottom event detail panel, providing deeper insights into the agent's execution flow.
467
535
468
-
### 2\.`pytest`\-Run Tests Programmatically
536
+
### Run Tests Programmatically
469
537
470
538
You can also use **`pytest`** to run test files as part of your integration tests.
This approach allows you to integrate agent evaluations into your CI/CD pipelines or larger test suites. If you want to specify the initial session state for your tests, you can do that by storing the session details in a file and passing that to `AgentEvaluator.evaluate` method.
496
564
497
-
### 3\.`adk eval`\-Run Evaluations via the CLI
565
+
### Run Evaluations via the CLI
498
566
499
567
You can also run evaluation of an eval set file through the command line interface (CLI). This runs the same evaluation that runs on the UI, but it helps with automation, i.e. you can add this command as a part of your regular build generation and verification process.
500
568
@@ -524,3 +592,41 @@ Here are the details for each command line argument:
524
592
`This will only run eval_1, eval_2 and eval_3 from sample_eval_set_file.json`
525
593
*`CONFIG_FILE_PATH`: The path to the config file.
526
594
*`PRINT_DETAILED_RESULTS`: Prints detailed results on the console.
595
+
596
+
### Run conformance tests
597
+
598
+
You can run all your tests at once, run specific ones, or create a summary report.
599
+
600
+
#### Run All Tests
601
+
602
+
If you don't type a specific folder path, the tool automatically looks for a tests/ folder in your workspace and runs everything inside it:
603
+
604
+
```
605
+
adk conformance test
606
+
```
607
+
608
+
#### Run Specific Test Groups or Individual Cases
609
+
610
+
Pass one or more folder paths to narrow down which tests execute:
611
+
612
+
```
613
+
614
+
# Test an entire category of tests
615
+
adk conformance test tests/core
616
+
617
+
# Test one specific case
618
+
adk conformance test tests/core/description_001
619
+
620
+
```
621
+
622
+
#### Generate Markdown Test Reports
623
+
624
+
Add the `--generate_report` flag to produce a clean test summary report. You can optionally specify where to save it using the `--report_dir parameter`:
625
+
626
+
```
627
+
# Save the report in a specific folder
628
+
adk conformance test --generate_report --report_dir=reports
629
+
```
630
+
631
+
#### Automating with CI/CD
632
+
Because adk conformance test is a command-line tool that fails if things don't match, it is highly useful for CI/CD pipelines. You can set it up to run automatically whenever someone opens a pull request, blocking any code from merging if it changes the agent's expected behavior.
0 commit comments