forked from langwatch/better-agents
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_customer_support_agent.py
More file actions
48 lines (40 loc) · 1.53 KB
/
test_customer_support_agent.py
File metadata and controls
48 lines (40 loc) · 1.53 KB
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
import uuid
import pytest
from scenario import Scenario, TestingAgent
from customer_support_agent import call_agent
Scenario.configure(
testing_agent=TestingAgent(model="gemini/gemini-2.5-flash-preview-04-17"),
cache_key="42",
)
@pytest.mark.agent_test
@pytest.mark.asyncio
async def test_get_order_status():
scenario = Scenario(
"User asks about the status of their last order",
agent=call_agent,
success_criteria=[
"The agent replies with the order status",
],
failure_criteria=[
"The agent says it does not have access to the user's order history",
"Agent should not ask for the order id without giving the user options to choose from",
],
)
await scenario.run({"thread_id": uuid.uuid4()})
@pytest.mark.agent_test
@pytest.mark.asyncio
async def test_get_customer_asking_for_a_refund():
scenario = Scenario(
"User complains that the Airpods they received are not working, asks if they can return it, gets annoyed, asks for a refund",
agent=call_agent,
strategy="behave as a very annoyed customer",
success_criteria=[
"The agent explains the refund policy",
"The agent hands it over to a human agent",
],
failure_criteria=[
"The agent says it does not have access to the user's order history",
"Agent should not ask for the order id without giving the user options to choose from",
],
)
await scenario.run({"thread_id": uuid.uuid4()})