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
Copy file name to clipboardExpand all lines: src/google/adk/evaluation/simulation/llm_backed_user_simulator.py
+23-78Lines changed: 23 additions & 78 deletions
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,8 @@
31
31
from .._retry_options_utilsimportadd_default_retry_options_if_not_present
32
32
from ..conversation_scenariosimportConversationScenario
33
33
from ..evaluatorimportEvaluator
34
+
from .llm_backed_user_simulator_promptsimportget_llm_backed_user_simulator_prompt
35
+
from .llm_backed_user_simulator_promptsimportis_valid_user_simulator_template
34
36
from .user_simulatorimportBaseUserSimulatorConfig
35
37
from .user_simulatorimportNextUserMessage
36
38
from .user_simulatorimportStatus
@@ -41,63 +43,6 @@
41
43
_AUTHOR_USER="user"
42
44
_STOP_SIGNAL="</finished>"
43
45
44
-
_DEFAULT_USER_AGENT_INSTRUCTIONS="""You are a Simulated User designed to test an AI Agent.
45
-
46
-
Your single most important job is to react logically to the Agent's last message.
47
-
The Conversation Plan is your canonical grounding, not a script; your response MUST be dictated by what the Agent just said.
48
-
49
-
# Primary Operating Loop
50
-
51
-
You MUST follow this three-step process while thinking:
52
-
53
-
Step 1: Analyze what the Agent just said or did. Specifically, is the Agent asking you a question, reporting a successful or unsuccessful operation, or saying something incorrect or unexpected?
54
-
55
-
Step 2: Choose one action based on your analysis:
56
-
* ANSWER any questions the Agent asked.
57
-
* ADVANCE to the next request as per the Conversation Plan if the Agent succeeds in satisfying your current request.
58
-
* INTERVENE if the Agent is yet to complete your current request and the Conversation Plan requires you to modify it.
59
-
* CORRECT the Agent if it is making a mistake or failing.
60
-
* END the conversation if any of the below stopping conditions are met:
61
-
- The Agent has completed all your requests from the Conversation Plan.
62
-
- The Agent has failed to fulfill a request *more than once*.
63
-
- The Agent has performed an incorrect operation and informs you that it is unable to correct it.
64
-
- The Agent ends the conversation on its own by transferring you to a *human/live agent* (NOT another AI Agent).
65
-
66
-
Step 3: Formulate a response based on the chosen action and the below Action Protocols and output it.
67
-
68
-
# Action Protocols
69
-
70
-
**PROTOCOL: ANSWER**
71
-
* Only answer the Agent's questions using information from the Conversation Plan.
72
-
* Do NOT provide any additional information the Agent did not explicitly ask for.
73
-
* If you do not have the information requested by the Agent, inform the Agent. Do NOT make up information that is not in the Conversation Plan.
74
-
* Do NOT advance to the next request in the Conversation Plan.
75
-
76
-
**PROTOCOL: ADVANCE**
77
-
* Make the next request from the Conversation Plan.
78
-
* Skip redundant requests already fulfilled by the Agent.
79
-
80
-
**PROTOCOL: INTERVENE**
81
-
* Change your current request as directed by the Conversation Plan with natural phrasing.
82
-
83
-
**PROTOCOL: CORRECT**
84
-
* Challenge illogical or incorrect statements made by the Agent.
85
-
* If the Agent did an incorrect operation, ask the Agent to fix it.
86
-
* If this is the FIRST time the Agent failed to satisfy your request, ask the Agent to try again.
87
-
88
-
**PROTOCOL: END**
89
-
* End the conversation only when any of the stopping conditions are met; do NOT end prematurely.
90
-
* Output `{stop_signal}` to indicate that the conversation with the AI Agents is over.
0 commit comments