Corvic MCP for GenAI Agent Testing

This example demonstrates how to build a lightweight GenAI testing framework using Corvic MCP and a Jupyter notebook. It reads structured test queries from a CSV file, invokes a Corvic-powered agent, and saves the responses alongside expected answers for comparison.


Use Case

You want to automatically evaluate the output of a Corvic agent across a list of test questions with known expected answers. This is useful for regression testing, QA, and validation of LLM-based applications.


Steps

  1. Configure Corvic Agent Endpoint:
    • Set MCP_URL to your deployed Corvic agent's endpoint.
    • Set the HEADERS with your Corvic API token.
  2. Prepare the Input Dataset:
    • Create a CSV file with at least the following columns: id, question, expected_answer.
    • Set the INPUT_CSV_PATH to the location of this CSV file.
  3. Configure Output:
    • Set the OUTPUT_PATH where the agent's responses will be written as an Excel file.

Input Format (CSV)

csv
1
2
3
4

Output

An Excel file containing the following columns:

  • id
  • question
  • expected_answer (expected answer)
  • response (from Corvic)

The following Python code (from the Jupyter Notebook) demonstrates the testing setup:

Corvic AI Logo

Corvic AI Agent Testing via API

Corvic AI agents deployed in production can be tested using APIs. This notebook demonstrates how to interact with deployed agents programmatically, enabling automated testing and integration into various workflows.

In [ ]: 
python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
In [ ]: 
python
1
2
Out[ ]: 
Querying ID 1: What is the NAICS code for wheat farming?
Response: 111140
Querying ID 2: How is retail defined in NAICS?
Response: Retail involves selling goods directly to customers,...
✅ Done. Results saved to /PATH_TO_STORE_RESPONSES/output.xlsx

Need help? Contact support@corvic.ai or visit https://www.corvic.ai.