Skip to content

Commit b03486c

Browse files
committed
perf: update webshop prompt
1 parent 8c25155 commit b03486c

File tree

1 file changed

+67
-17
lines changed

1 file changed

+67
-17
lines changed
Lines changed: 67 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,79 @@
1+
# Copyright 2025 Nanyang Technological University (NTU), Singapore
2+
# and the verl-agent (GiGPO) team.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
116
# --------------------- WebShop --------------------- #
217
WEBSHOP_TEMPLATE_NO_HIS = """
3-
You are an expert autonomous agent operating in the WebShop e‑commerce environment.
4-
Your task is to: {task_description}.
5-
Your current observation is: {current_observation}.
6-
Your admissible actions of the current situation are:
7-
[
18+
You are an expert agent operating in the WebShop e‑commerce environment.
19+
Your task is: {task_description}
20+
Your current observation is: {current_observation}
21+
Your admissible actions of the current situation are: [
822
{available_actions}
923
].
1024
11-
Now it's your turn to take one action for the current step.
12-
You should first reason step-by-step about the current situation, then think carefully which admissible action best advances the shopping goal. This reasoning process MUST be enclosed within <think> </think> tags.
13-
Once you've finished your reasoning, you should choose an admissible action for current step and present it within <action> </action> tags.
25+
Please begin by analyzing the situation and planning your approach:
26+
27+
<plan>
28+
Analyze the current shopping situation and devise a plan to accomplish the task: {task_description}
29+
What are the key steps needed to complete this task (e.g., search with the right keywords, open a relevant product, compare options, select attributes, finalize)?
30+
Based on the current observation, what should be my immediate next step?
31+
How does this action advance my plan toward completing the shopping goal?
32+
</plan>
33+
34+
Finally, choose ONE admissible action for the current step and present it within <action> </action> tags.
1435
"""
1536

1637
WEBSHOP_TEMPLATE = """
17-
You are an expert autonomous agent operating in the WebShop e‑commerce environment.
18-
Your task is to: {task_description}.
38+
You are an expert agent operating in the WebShop e‑commerce environment.
39+
Your task is: {task_description}
1940
Prior to this step, you have already taken {step_count} step(s). Below are the most recent {history_length} observations and the corresponding actions you took: {action_history}
20-
You are now at step {current_step} and your current observation is: {current_observation}.
21-
Your admissible actions of the current situation are:
22-
[
41+
You are now at step {current_step} and your current observation is: {current_observation}
42+
Your admissible actions of the current situation are: [
2343
{available_actions}
2444
].
2545
26-
Now it's your turn to take one action for the current step.
27-
You should first reason step-by-step about the current situation, then think carefully which admissible action best advances the shopping goal. This reasoning process MUST be enclosed within <think> </think> tags.
28-
Once you've finished your reasoning, you should choose an admissible action for current step and present it within <action> </action> tags.
29-
"""
46+
Now it's your turn to take an action.
47+
48+
You should first recall relevant past experience and reason from our conversation history, then MUST summarize within <memory_recall> </memory_recall> tags like this:
49+
50+
<memory_recall>
51+
[Recall relevant past experiences and reason from our conversation history]
52+
Recent action history ({step_count} steps taken): {action_history}
53+
- What similar shopping situations have I encountered?
54+
- What strategies worked or failed before (e.g., search terms, product filtering, option selection)?
55+
- What products, attributes, or pages have I already explored?
56+
- What was my previous reasoning and plan?
57+
</memory_recall>
58+
59+
After that, you should reflect on the last action and its outcome, then MUST summarize within <reflection> </reflection> tags like this:
60+
61+
<reflection>
62+
[Reflect on the last action and its outcome]
63+
- What did my last action accomplish?
64+
- Was it successful or did it encounter issues?
65+
- How does this outcome affect my plan?
66+
- Am I making progress toward the task goal: {task_description}?
67+
</reflection>
68+
69+
After that, you should plan the next step based on memory and reflection, then MUST summarize within <think> </think> tags like this:
70+
71+
<think>
72+
[Plan the next step based on memory and reflection]
73+
- Given what I've learned, what should I do next?
74+
- How does this action fit into my overall shopping strategy?
75+
- What do I expect this action to achieve now?
76+
</think>
77+
78+
Finally, choose ONE admissible action for the current step and present it within <action> </action> tags.
79+
"""

0 commit comments

Comments
 (0)