A-Mahla commited on
Commit
f505f2c
·
unverified ·
1 Parent(s): 4b9f35b

ADD new instructions (#24)

Browse files

* ADD new instructions

* ADD new instructions

* FIX pre-commit

* FIX pre-commit

cua2-core/src/cua2_core/models/models.py CHANGED
@@ -400,15 +400,7 @@ class AvailableModelsResponse(BaseModel):
400
  models: list[str]
401
 
402
 
403
- class GenerateInstructionRequest(BaseModel):
404
- """Request model for generating task instruction"""
405
-
406
- model_id: str
407
- prompt: Optional[str] = None
408
-
409
-
410
  class GenerateInstructionResponse(BaseModel):
411
  """Response model for generated task instruction"""
412
 
413
  instruction: str
414
- model_id: str
 
400
  models: list[str]
401
 
402
 
 
 
 
 
 
 
 
403
  class GenerateInstructionResponse(BaseModel):
404
  """Response model for generated task instruction"""
405
 
406
  instruction: str
 
cua2-core/src/cua2_core/routes/routes.py CHANGED
@@ -3,7 +3,6 @@ from datetime import datetime
3
  # Get services from app state
4
  from cua2_core.models.models import (
5
  AvailableModelsResponse,
6
- GenerateInstructionRequest,
7
  GenerateInstructionResponse,
8
  HealthResponse,
9
  UpdateStepRequest,
@@ -50,18 +49,11 @@ async def get_available_models():
50
 
51
 
52
  @router.post("/generate-instruction", response_model=GenerateInstructionResponse)
53
- async def generate_task_instruction(
54
- request: GenerateInstructionRequest,
55
- ):
56
- """Generate a task instruction using a specified model"""
57
  try:
58
- instruction = InstructionService.generate_instruction(
59
- model_id=request.model_id, prompt=request.prompt
60
- )
61
-
62
- return GenerateInstructionResponse(
63
- instruction=instruction, model_id=request.model_id
64
- )
65
 
66
  except ValueError as e:
67
  raise HTTPException(status_code=400, detail=str(e))
 
3
  # Get services from app state
4
  from cua2_core.models.models import (
5
  AvailableModelsResponse,
 
6
  GenerateInstructionResponse,
7
  HealthResponse,
8
  UpdateStepRequest,
 
49
 
50
 
51
  @router.post("/generate-instruction", response_model=GenerateInstructionResponse)
52
+ async def generate_task_instruction():
53
+ """Get a random task instruction from the pregenerated pool"""
 
 
54
  try:
55
+ instruction = InstructionService.get_random_instruction()
56
+ return GenerateInstructionResponse(instruction=instruction)
 
 
 
 
 
57
 
58
  except ValueError as e:
59
  raise HTTPException(status_code=400, detail=str(e))
cua2-core/src/cua2_core/services/agent_utils/get_model.py CHANGED
@@ -4,6 +4,7 @@ from smolagents import InferenceClientModel, Model
4
  AVAILABLE_MODELS = [
5
  "Qwen/Qwen3-VL-8B-Instruct",
6
  "Qwen/Qwen3-VL-30B-A3B-Instruct",
 
7
  ]
8
 
9
 
 
4
  AVAILABLE_MODELS = [
5
  "Qwen/Qwen3-VL-8B-Instruct",
6
  "Qwen/Qwen3-VL-30B-A3B-Instruct",
7
+ "Qwen/Qwen3-VL-235B-A22B-Instruct",
8
  ]
9
 
10
 
cua2-core/src/cua2_core/services/agent_utils/instruction_utils/pregenerated_instructions.json ADDED
@@ -0,0 +1,328 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, World!' at the beginning of the document, and save it as 'greeting.odt' on the desktop.",
3
+ "Click the desktop to ensure focus, then open a new mousepad window, type 'Meeting notes: [current date and time]', press Enter, and leave the cursor ready for additional input.",
4
+ "Open the terminal application on your desktop, then type the command 'ls -la” and press Enter to list all files and directories in the current directory with detailed information.",
5
+ "List all running processes with their PID, user, and command using: ps aux",
6
+ "Go to weather.com and search for the current weather conditions in Tokyo, Japan, including temperature, humidity, and chance of precipitation.",
7
+ "Automate the process of moving all .txt files from the Downloads folder to a newly created 'TextFiles” folder on the desktop using a single script or command in the terminal.",
8
+ "List the current date and time in UTC.",
9
+ "Open mousepad, type 'Task Note: [your note here]', save as 'notes.txt' on Desktop, then close mousepad.",
10
+ "Create a new directory named 'Automation_Tasks' in your home directory, then inside it create three subdirectories: 'Logs', 'Backups', and 'Scripts'.",
11
+ "Visit amazon.com and search for 'wireless earbuds under $50”, then sort results by 'Price: Low to High” and click the first product link.",
12
+ "Create a new text file named 'notes.txt' on the desktop, then open it and type: 'Task completed. System clean. No prior configs.' Save and close the file.",
13
+ "Open the mousepad application, type 'Meeting notes: Discuss project timeline and budget,' then save the file as 'meeting_notes.txt' on the desktop.",
14
+ "Click and drag to select the text 'Hello World” on the desktop, then right-click and choose 'Copy” from the context menu.",
15
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, automation world!', save it as 'greeting.odt' on the desktop, then close LibreOffice.",
16
+ "Create a new directory named 'Automated_Tasks' in the user's home directory.",
17
+ "Visit weather.com and check the 10-day forecast for New York City.",
18
+ "Navigate to https://www.weather.com and search for the current weather in New York City by entering 'New York City' into the search bar and pressing Enter.",
19
+ "Automate the process of moving all .txt files from the Downloads folder to a newly created 'TextFiles” folder on the desktop.",
20
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, world!', and save it as 'greeting.odt' on the desktop.",
21
+ "Automatically create a new text file named 'Note_YYYYMMDD_HHMMSS.txt' on the desktop with the current date and time as its content.",
22
+ "Go to https://www.weather.com and check the 10-day forecast for New York City.",
23
+ "Open a new terminal window, create a directory named 'temp_automation”, navigate into it, create an empty file named 'test.txt', and then display the contents of the current directory.",
24
+ "Navigate to weather.com and search for the current weather conditions in Tokyo, Japan by entering 'Tokyo” into the search bar and selecting the correct location from the dropdown results.",
25
+ "List all files and directories in the current working directory, including hidden ones, sorted by modification time with the most recent first.",
26
+ "Open LibreOffice Writer, create a new blank document, type the text 'Hello, this is a test document.', and save it as 'test_document.odt' on the desktop.",
27
+ "Create a new directory named 'project_temp' in the current working directory.",
28
+ "Open your terminal application and execute the command to list all files and directories in the current directory, including hidden ones, in a detailed format.",
29
+ "Create a new directory named 'Automation_Tasks” on the desktop, then inside it, create three empty files named 'task1.txt', 'task2.txt', and 'task3.txt'.",
30
+ "Create a new directory named 'automation_backup' in your home directory, then create an empty text file named 'log.txt' inside it.",
31
+ "Open the terminal application on your desktop, type the command `ls -la` to list all files and directories in the current directory with detailed information, then press Enter to execute it.",
32
+ "Open a blank text document and take notes about your current task using the mousepad, then save the document as 'TaskNotes.txt' on the desktop.",
33
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, this is an automated test document.', save it as 'automated_test.odt' on the desktop, then close LibreOffice Writer.",
34
+ "Open mousepad, type 'Meeting Notes: Project X - Discuss timeline and deliverables', save the file as 'meeting_notes.txt' on the desktop, then close mousepad.",
35
+ "Open LibreOffice Writer, create a new blank document, type the text: 'Automated Task Completed Successfully.', save it as 'Automation_Report.odt' on the desktop, and then close the application.",
36
+ "Create a new text file named 'Notes.txt' on the desktop, then open it in mousepad and type: 'Mousepad Notes — Start here. Date: [current date]'. Save and keep the file open for ongoing note-taking.",
37
+ "Place a blank white mousepad on the desktop surface directly in front of the keyboard.",
38
+ "Create a new folder named 'Notes” on the desktop, then inside it, create a text file named 'Mousepad.txt' and open it for editing.",
39
+ "List all files and directories in the current directory, including hidden ones.",
40
+ "Open https://www.amazon.com and search for 'wireless headphones' in the search bar.",
41
+ "Create a new folder named 'Notes” on the desktop, then inside it create a text file named 'Mousepad_Notes.txt' and open it in mousepad for immediate note-taking.",
42
+ "Write 'Meeting Notes: [current date]' in the top-left corner of the mousepad.",
43
+ "Navigate to weather.com and search for the current weather in Tokyo, Japan by entering 'Tokyo” into the search bar and selecting the correct location from the dropdown suggestions.",
44
+ "Create a new directory named 'Backup' in the current working directory.",
45
+ "Create a new LibreOffice Writer document, insert the text 'Automated Task: Document Generated on [Current Date]', and save it as 'automated_document.odt” on the desktop.",
46
+ "Visit amazon.com and search for 'wireless Bluetooth headphones”, then filter results by customer rating of 4 stars and above.",
47
+ "mkdir -p ~/Documents/Reports && touch ~/Documents/Reports/{Q1,Q2,Q3,Q4}.txt && chmod 644 ~/Documents/Reports/*.txt",
48
+ "Create a new folder named 'Notes” on the desktop, then inside it, create a text file named 'Daily_Notes.txt' and open it in mousepad for immediate use.",
49
+ "Create a new directory named 'Automated_Tasks' on the desktop, then create a text file inside it called 'log.txt' and write the current date and time into the file.",
50
+ "Create a new LibreOffice Writer document, type 'Automated Task Completed.', save it as 'automation_test.odt” on the desktop, and close the application.",
51
+ "Create a new directory named 'Automation_Tasks' in your home directory, then inside it create three subdirectories: 'Logs', 'Scripts', and 'Backups'.",
52
+ "Open LibreOffice Writer, create a new blank document, type the text: 'Automated Task Completed Successfully.', then save the document as 'Automation_Report.odt' on the desktop.",
53
+ "Create a new directory named 'automation_task', navigate into it, create a file called 'script.sh' with the content: '#!/bin/bash\\n echo 'Automation complete!'', make it executable, and run it.",
54
+ "Open a blank text document and type your notes about today’s tasks, then save the file as 'Today’s Notes.txt' on the desktop.",
55
+ "Navigate to weather.com and search for the current weather conditions in Tokyo, Japan by entering 'Tokyo” into the search bar and selecting the correct location from the dropdown suggestions.",
56
+ "Create a new directory named 'backup_$(date +%Y%m%d)' in the current working directory.",
57
+ "Open https://www.wikipedia.org and search for 'artificial intelligence' using the main search bar.",
58
+ "Visit https://www.imdb.com and search for the movie 'Inception' to find its release year and director.",
59
+ "Create a new text file named 'Notes.txt' on the desktop, open it, and type: 'Task completed: Desktop automation agent successfully created and saved this note.' Then close the file.",
60
+ "Open LibreOffice Writer, create a new blank document, type the exact text: 'Automation Test Document – Generated on [current date]', then save the document as 'Automation_Test.docx” on the desktop.",
61
+ "Create a new empty file named 'note.txt' in the current directory.",
62
+ "Go to amazon.com and search for 'wireless Bluetooth headphones”, then add the first result to the cart.",
63
+ "Create a new directory named 'Automated_Backup' on the desktop.",
64
+ "Open mousepad, type a brief reminder about your next meeting, save the file to your Desktop with the name 'MeetingReminder.txt', then close mousepad.",
65
+ "Create a new directory named 'Automated_Tasks' on the desktop, then inside it create two subdirectories named 'Logs' and 'Backups'.",
66
+ "Open mousepad, type 'Task Note: [your note here]', save as 'note.txt' on Desktop, then close mousepad.",
67
+ "Click the desktop, press Ctrl+Alt+N to open a new mousepad window, type 'Note: [current date and time] — Task started.', save as 'Notes.txt' on the desktop, then minimize mousepad.",
68
+ "Go to amazon.com and search for 'wireless headphones”, then add the first result to the cart.",
69
+ "Create a new directory named 'automation_backup' in your home directory, then navigate into it.",
70
+ "Create a new directory named 'Projects' in your home folder.",
71
+ "Create a new directory named 'project_backup' on the desktop, then copy all .txt files from the Documents folder into it.",
72
+ "Open LibreOffice Writer, create a new blank document, type the following text exactly: 'Automated task completed successfully.', then save the document as 'automation_test.odt” on the desktop.",
73
+ "Open the terminal and create a new directory named 'my_project' in your home directory.",
74
+ "Open the terminal application on your desktop, then execute the command to list all files and directories in the current working directory, including hidden ones.",
75
+ "Write 'Meeting Notes:' at the top of a blank text area on the screen.",
76
+ "Create a new directory named 'my_project' in the current working directory.",
77
+ "Navigate to weather.com and search for the current weather in Tokyo by entering 'Tokyo” in the search bar and selecting the correct result from the dropdown.",
78
+ "Create a new directory named 'Automation_Tasks' in your home folder, then inside it create two subdirectories: 'Incoming' and 'Processed'.",
79
+ "Create a new directory named 'automation_project', navigate into it, create a file called 'script.sh' with the content: '#!/bin/bash\\n echo 'Hello from automation!'', make it executable, and run it.",
80
+ "Click the center of the screen, then drag downward 200 pixels to simulate highlighting text on a blank canvas for note-taking.",
81
+ "Create a new directory named 'automation_logs' in your home directory, then create a text file inside it called 'task_summary.txt' and write the line 'Task completed successfully.' into the file.",
82
+ "Write 'Meeting Notes: ' at the top of a blank text document.",
83
+ "Navigate to weather.com and search for the current weather forecast in Tokyo, Japan by entering 'Tokyo” into the search bar and selecting the correct result from the dropdown.",
84
+ "Create a new empty directory named 'temp' in the current working directory.",
85
+ "Open mousepad, type 'Meeting Notes: [Current Date] – Key points:', save the file as 'Meeting_Notes_[Current_Date].txt' on the Desktop, then close mousepad.",
86
+ "Navigate to https://www.weather.com and search for the current weather in Tokyo, Japan, then extract and report the temperature and condition.",
87
+ "Open mousepad, type 'Meeting Notes: [Current Date] – Key points: 1. 2. 3.', save the file to Desktop as 'Meeting_Notes_YYYYMMDD.txt', then minimize mousepad.",
88
+ "Create a new directory named 'automation_task', navigate into it, create a file named 'script.sh' containing the line `echo 'Automation complete!'`, make the script executable, and run it.",
89
+ "Go to weather.com and search for the current weather forecast for Tokyo, Japan, including temperature, precipitation chance, and wind speed.",
90
+ "List all files and directories in the current directory, including hidden ones, in long format.",
91
+ "Visit weather.com and search for the current weather forecast in Tokyo, Japan.",
92
+ "mkdir -p ~/Desktop/{Documents,Images,Videos,Downloads} && touch ~/Desktop/{Documents/file1.txt,Images/photo.jpg,Videos/movie.mp4,Downloads/archive.zip}",
93
+ "Automatically move all .tmp files from the Downloads folder to a dedicated Trash folder in the home directory.",
94
+ "Go to amazon.com and search for 'wireless earbuds”, then add the first result with a 4.5-star rating or higher to the cart.",
95
+ "Open a terminal and create a new directory named 'automation_task' in your home directory, then navigate into it.",
96
+ "Navigate to https://www.weather.com and search for the current weather in New York City by entering 'New York City' in the search bar and selecting the top result.",
97
+ "Open the terminal application and execute the command to list all files and directories in the current working directory, including hidden ones.",
98
+ "Go to news.ycombinator.com and scroll down to read the top 10 headlines, then click the first story link to open the full article.",
99
+ "Create a new directory named 'Automated_Tasks' on the desktop and inside it, create three empty text files named 'task1.txt', 'task2.txt', and 'task3.txt'.",
100
+ "Create a new text file named 'notes.txt' on the desktop, then open it and type: 'Task completed: Note-taking mousepad setup.' Save and close the file.",
101
+ "Open the mousepad application, type 'Meeting notes: Discuss project timeline and budget”, then save the file as 'meeting_notes.txt' on the desktop.",
102
+ "Create a new text file named 'mousepad.txt' on the desktop, open it, and type: 'Meeting at 3 PM – bring project draft. Follow up with Alex re: budget.' Save and close the file.",
103
+ "Navigate to https://www.wikipedia.org and search for the term 'artificial intelligence' using the main search bar.",
104
+ "Create a new LibreOffice Writer document, type 'Automated Task: Hello World!', save it as 'test_document.odt” on the desktop, then close the application.",
105
+ "Navigate to weather.com and search for the current weather conditions in Tokyo, Japan by entering 'Tokyo” into the search bar and selecting the correct result from the dropdown.",
106
+ "Go to https://www.weather.com and search for the current weather in New York City.",
107
+ "List all running processes with their PID, user, and command using the `ps` command.",
108
+ "Visit weather.com and check the current temperature for New York City.",
109
+ "Open a new terminal window, create a directory named 'automation_test', navigate into it, create an empty file named 'log.txt', and display the current directory path.",
110
+ "Navigate to https://www.amazon.com and search for 'wireless headphones' using the search bar at the top of the page.",
111
+ "Visit https://news.ycombinator.com and scroll down to view the latest hacker news posts.",
112
+ "Create a new text file named 'Mousepad_Notes.txt' on the desktop, open it, and type: 'Task completed: Note-taking mousepad initialized. No prior data required.' Then save and close the file.",
113
+ "Open a terminal, create a new directory named 'automation_test”, navigate into it, create an empty file named 'log.txt', and then display the current directory path.",
114
+ "Create a new directory named 'automation_tasks' on the desktop, then inside it create a text file named 'task_log.txt' containing the single line: 'Task initiated on $(date)'.",
115
+ "Create a directory named 'auto_tasks' in the home folder, then create three subdirectories inside it: 'input', 'output', and 'logs'.",
116
+ "Create a new directory named 'Automation_Tasks' in the user's home directory.",
117
+ "Open mousepad, type 'Meeting Notes:' followed by three bullet points — 'Agenda,' 'Action Items,' 'Next Steps” — then save the file as 'MeetingNotes.txt' on your desktop.",
118
+ "Create a new directory named 'Automated_Backup' on the desktop and inside it, create three empty text files named 'log_1.txt', 'log_2.txt', and 'log_3.txt'.",
119
+ "Create a new directory named 'project_alpha' on the desktop, navigate into it, and initialize a Git repository with an initial commit containing a README.md file that says 'Initial commit'.",
120
+ "Go to spotify.com and log in using the credentials stored in the system keychain, then play the playlist titled 'Chill Vibes” from the user’s library.",
121
+ "Visit https://www.reddit.com/r/Python and scroll down to view the top 5 posts.",
122
+ "Create a new directory named 'project_backup' in the current user's home directory.",
123
+ "Create a new directory named 'Automation_Tasks' in the user's home directory, then inside it, create three empty text files named 'task1.txt', 'task2.txt', and 'task3.txt'.",
124
+ "Create a new directory named 'project_files' in the user's home directory.",
125
+ "Create a new directory named 'project_alpha' on the desktop, navigate into it, and initialize a Git repository inside.",
126
+ "Create a new directory named 'Automated_Tasks' on the desktop, then inside it create two subdirectories named 'Input' and 'Output'.",
127
+ "Open LibreOffice Writer, create a new document, type 'Hello, this is a test document.', save it as 'test_document.odt” on the desktop, and then close LibreOffice.",
128
+ "Automatically create a new text file on the desktop named 'Note_YYYYMMDD_HHMMSS.txt' and open it in the default text editor.",
129
+ "Open a blank text document and type a short note about your current task, then save it as 'task_note.txt' on the desktop.",
130
+ "Create a new directory named 'Automated_Tasks' on the desktop and inside it, create three empty text files: 'task1.txt', 'task2.txt', and 'task3.txt'.",
131
+ "Open LibreOffice Writer, create a new blank document, type 'Automated Task Completed Successfully.', save the document as 'AutomationReport.odt' on the desktop, then close LibreOffice Writer.",
132
+ "Create a new directory named 'Automated_Tasks' in the user's home directory, then inside it, create three empty text files named 'task1.txt', 'task2.txt', and 'task3.txt'.",
133
+ "Open mousepad, type 'Meeting notes:', press Enter, then type '- Discuss project timeline” and '- Review budget estimates”, each on a new line. Save the document as 'Notes.txt' on the Desktop.",
134
+ "Open LibreOffice Writer, create a new blank document, type the text 'Hello, this is an automated test.', and save the document as 'test_document.odt' on the desktop.",
135
+ "Write 'Meeting Notes: [Date]' in the top-left corner of the mousepad.",
136
+ "Create a new directory named 'automation_task', navigate into it, generate a file called 'script.sh' containing the line 'echo 'Hello from automation!'', make the script executable, and run it.",
137
+ "Visit wikipedia.org and search for 'climate change' to read the introduction section of the article.",
138
+ "Open LibreOffice Writer, create a new document, type 'Hello, World!' on the first line, save the document as 'greeting.odt' on the desktop, and close LibreOffice.",
139
+ "Open LibreOffice Writer, create a new document, type 'Hello, this is a test document.', and save it as 'test_document.odt' on the desktop.",
140
+ "Visit wikipedia.org and search for 'Artificial Intelligence', then read the first paragraph of the main article.",
141
+ "Go to https://www.weather.com and search for the current weather in Tokyo, Japan.",
142
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, this is an automated test.', save it as 'automated_test.odt” on the Desktop, then close LibreOffice Writer.",
143
+ "List all running processes with their PID, user, and command name in a sorted order by CPU usage.",
144
+ "Open mousepad, type 'Task: Record daily automation progress — [Date]', save as 'AutomationLog.txt' on Desktop, then close mousepad.",
145
+ "Visit weather.com and search for the current weather in Tokyo, Japan.",
146
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, Automation World!' on the first line, save the document as 'automation_test.odt' on the desktop, then close LibreOffice Writer.",
147
+ "Visit https://www.wikipedia.org and search for 'artificial intelligence' in the main search bar.",
148
+ "Create a directory named 'AutomationLogs' in the home folder, then create three empty files inside it: 'log1.txt', 'log2.txt', and 'log3.txt'.",
149
+ "Navigate to wikipedia.org and search for 'Artificial Intelligence” using the main search bar, then open the first article result titled 'Artificial Intelligence”.",
150
+ "Visit weather.com and search for the current weather forecast for Tokyo, Japan.",
151
+ "Automatically move all .log files from the Downloads directory to a new Logs archive directory in the user’s home folder.",
152
+ "Navigate to weather.com and enter 'New York City” in the search bar to retrieve the current weather conditions, including temperature, precipitation chance, and wind speed.",
153
+ "Go to spotify.com and log in using the credentials stored in the system keychain, then navigate to the 'Liked Songs' playlist and play the first track.",
154
+ "Go to weather.com and search for the current weather conditions in Tokyo, Japan, including temperature, humidity, and precipitation chance.",
155
+ "Create a new directory named 'test_folder' in the user's home directory.",
156
+ "Create a new directory named 'automation_logs' in your home directory, then create an empty text file named 'task_summary.txt' inside it.",
157
+ "Automatically create a new LibreOffice Writer document, insert the text 'Hello, World!', and save it as 'greeting.odt” on the desktop.",
158
+ "Open a blank text document and take notes about your current task, then save the file as 'task_notes.txt' on the desktop.",
159
+ "Create a new directory named 'automation_task', navigate into it, create a file named 'script.sh' containing the line `echo 'Automation successful!'`, make the script executable, and run it.",
160
+ "Create a new text file named 'mousepad.txt' on the desktop, open it, and type: 'Meeting notes: [Insert brief summary of a fictional meeting here].' Save and close the file.",
161
+ "Visit https://www.reddit.com/r/technology and scroll down to view the top 10 posts.",
162
+ "Create a new directory named 'Automated_Tasks' on the desktop and place an empty text file named 'log.txt' inside it.",
163
+ "Open the terminal and create a new directory named 'test_folder” in your home directory.",
164
+ "Open mousepad, type 'Meeting Notes: [Current Date]' followed by three bullet points for key discussion items, then save the file to your Desktop with the name 'Meeting_Notes.txt'.",
165
+ "Navigate to weather.com and search for the current weather conditions in Tokyo, Japan by entering 'Tokyo” into the search bar and selecting the correct location from the dropdown.",
166
+ "Open LibreOffice Writer, create a new blank document, type the following text: 'Automated Task Completed Successfully”, then save the document as 'Automation_Report.odt” on your desktop.",
167
+ "Go to https://www.weather.com and check the current weather in New York City.",
168
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, this is an automated test.', then save it as 'automated_test.odt' on the desktop.",
169
+ "Open mousepad, type 'Meeting Notes:', press Enter, then type '- Agenda items” and '- Action items” on separate lines, and save the file as 'meeting_notes.txt' on the desktop.",
170
+ "Open the Mousepad application, type 'Meeting notes: Discuss project timeline and assign tasks', then save the file as 'meeting_notes.txt' on the desktop.",
171
+ "Create a new directory named 'project_setup' on the desktop, navigate into it, initialize a Git repository, and create a README.md file with the text 'Initial commit' inside.",
172
+ "Create a new LibreOffice Writer document, type 'Automated Task Completed.' at the center of the page, and save it as 'automation_result.odt” on the desktop.",
173
+ "Visit https://www.wikipedia.org and search for 'climate change' to read the introductory section of the article.",
174
+ "Open the terminal application and execute the command to list all files and directories in the current working directory, including hidden items.",
175
+ "Visit https://www.wikipedia.org and search for 'climate change' to read the introduction section of the article.",
176
+ "Open mousepad, type 'Meeting Notes: [Date] — Key points:', save as 'notes.txt' on Desktop, then minimize mousepad.",
177
+ "Visit https://www.reddit.com/r/AskReddit and scroll down to read the top 5 posts.",
178
+ "Navigate to https://www.google.com and search for 'latest Python 3.12 features', then click the first search result link.",
179
+ "Open LibreOffice Writer, create a new document, type 'Hello, world!' on the first line, and save the document as 'greeting.odt' on the desktop.",
180
+ "Write 'Meeting Notes: [Date]' in the top-left corner of the mousepad area.",
181
+ "List all running processes with their CPU and memory usage, sorted by CPU usage in descending order.",
182
+ "Create a new LibreOffice Writer document, type 'Automated Task Completed.' at the center of the page, and save it as 'auto_task.odt” on the desktop.",
183
+ "Go to news.ycombinator.com and scroll down to view the top 10 posts, then click the first post title to open its discussion page.",
184
+ "Create a new directory named 'backup' in the user's home folder.",
185
+ "Go to amazon.com and search for 'wireless headphones', then add the first result to the cart.",
186
+ "Click and drag to draw a rectangle on the desktop background, simulating a note-taking mousepad area.",
187
+ "Automate the process of moving all .log files from the current directory to a subdirectory named 'logs', creating the subdirectory if it does not already exist.",
188
+ "Create a new directory named 'automation_task' in your home directory, then create a text file named 'notes.txt' inside it with the content: 'Task completed successfully.'",
189
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, World!' at the beginning, and save it as 'greeting.odt' on the desktop.",
190
+ "Create a new directory named 'automation_tasks' in your home directory, then create a text file inside it named 'task_log.txt' and write the current date and time into the file.",
191
+ "Open LibreOffice Writer, create a new blank document, type 'Task completed successfully.', and save it as 'confirmation.txt' on the desktop.",
192
+ "Visit wikipedia.org and search for 'Artificial Intelligence” in the search bar, then click the first result to open the main article page.",
193
+ "Open mousepad, type 'Meeting Notes – [Today’s Date]' as the header, press Enter twice, then type '1. Attendees:' and press Enter. Position the cursor ready for the next line to begin listing names.",
194
+ "Navigate to weather.com and search for the current weather forecast in Tokyo, Japan by entering 'Tokyo” in the search bar and selecting the correct result from the dropdown list.",
195
+ "Create a new directory named 'Projects' in your home directory.",
196
+ "Go to news.ycombinator.com and scroll down to view the top 10 stories, then click the title of the third story to open it.",
197
+ "Create a new directory named 'project_setup' on the desktop, navigate into it, and initialize a Git repository inside.",
198
+ "Create a new directory named 'project_backup' in the current working directory and then list its contents to confirm it was created.",
199
+ "Open mousepad, type 'Meeting Notes: [Current Date] - Discuss project timeline and assign tasks.', save the file as 'MeetingNotes.txt' on the desktop, then close mousepad.",
200
+ "mkdir -p ~/Desktop/Archive && find ~/Desktop -type f -not -name 'Archive' -not -path '~/Desktop/Archive*' -exec mv {} ~/Desktop/Archive/ \\;",
201
+ "Open the Mousepad text editor, type 'Meeting notes:' followed by a new line, then save the file as 'notes.txt' on the desktop.",
202
+ "Open https://www.wikipedia.org and search for 'artificial intelligence' in the main search bar.",
203
+ "Click and drag to draw a rectangular selection on the desktop background, starting from the top-left corner and ending near the bottom-right corner.",
204
+ "Open LibreOffice Writer, create a new blank document, type 'Automated Task Completed Successfully.', save the document as 'Automation_Report.odt' on the desktop, then close LibreOffice Writer.",
205
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, World!' at the beginning of the document, and save it as 'greeting.odt” on the desktop.",
206
+ "Open mousepad, type 'Meeting notes: [current date] – Discuss project timeline and budget”, save the file as 'meeting_notes.txt' on the desktop, then close mousepad.",
207
+ "Navigate to https://www.amazon.com and search for 'wireless headphones' using the search bar, then press Enter.",
208
+ "Open LibreOffice Writer, create a new blank document, type the following text exactly: 'Automated task completed successfully.', then save the document as 'automation_report.odt” on the desktop.",
209
+ "Open https://www.google.com and search for 'latest AI advancements 2024'.",
210
+ "Create a new directory named 'automation_task', navigate into it, create a file called 'script.sh' with the content: `#!/bin/bash\\necho 'Automation complete!'`, make it executable, and run it.",
211
+ "Create a new directory named 'Automated_Tasks” on the desktop, then inside it create three empty text files named 'task1.txt', 'task2.txt', and 'task3.txt'.",
212
+ "Create a new directory named 'Projects' in the home folder, then create three subdirectories inside it: 'Web', 'Mobile', and 'Data'.",
213
+ "Open the terminal and run the command: 'mkdir ~/Desktop/test_folder' to create a new folder named 'test_folder' on the desktop.",
214
+ "Open a terminal, create a new directory named 'temp_folder', navigate into it, and create an empty file named 'placeholder.txt'.",
215
+ "Create a new directory named 'Backup_2024” in your home directory, then create a text file inside it named 'notes.txt' containing the single line: 'Initial backup created.'",
216
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, this is an automated test.', save the document as 'automated_test.odt” on the Desktop, then close LibreOffice Writer.",
217
+ "Navigate to https://www.imdb.com and search for 'Inception” in the top search bar, then click on the first result to open the movie’s main page.",
218
+ "Visit amazon.com and search for 'wireless earbuds under $50”, then sort results by customer rating and select the top-rated product to view its details page.",
219
+ "Create a new LibreOffice Writer document, insert the text 'Automated Task: Document Generated on [Current Date]', and save it as 'auto_document.odt” on the desktop.",
220
+ "Open a terminal window, create a new directory named 'automation_test”, navigate into it, and create an empty file named 'log.txt' inside the directory.",
221
+ "Create a new note on the desktop using a mousepad, titled 'Task List,' and write down three items you need to complete today.",
222
+ "Go to news.ycombinator.com and scroll down to view the top 10 stories, then click the first story link to open its full page.",
223
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, this is an automated test document.', save it as 'automated_test.odt” on the desktop, then close LibreOffice Writer.",
224
+ "Open your terminal application and execute the command to list all files and directories in the current directory, including hidden ones, sorted by modification time with the most recent first.",
225
+ "Open the terminal and create a new directory named 'test_folder' in your home directory.",
226
+ "Create a new directory named 'Automated_Tasks” on the desktop, then inside it, create three empty text files named 'task1.txt', 'task2.txt', and 'task3.txt'.",
227
+ "List all files in the current directory sorted by modification time, showing detailed information including permissions, owner, size, and date.",
228
+ "Go to weather.com and check the 5-day forecast for New York City.",
229
+ "Visit https://www.reddit.com/r/Python and scroll down to view the latest posts.",
230
+ "Open the Mousepad text editor, type 'Meeting notes: Project update scheduled for Friday', and save the file as 'meeting_notes.txt' on the desktop.",
231
+ "Open mousepad, type 'Meeting notes: Project X – 2024-06-15”, press Enter, then type '- Discuss timeline” and save the file as 'meeting_notes.txt' on the desktop.",
232
+ "Open a blank text document, type 'Meeting Notes: [Today’s Date] – Key points:', then save the file to the desktop with the name 'Meeting_Notes_[Today’s Date].txt' and close the document.",
233
+ "Go to weather.com and search for the current weather forecast in Tokyo, Japan, then extract the temperature and chance of precipitation for the next 24 hours.",
234
+ "Open a terminal window and execute the command: `mkdir -p ~/automation_test/{logs,scripts,config}` to create a structured directory for testing automation tasks.",
235
+ "Open mousepad, type 'Meeting notes:', press Enter, then type '- Discuss project timeline”, press Enter, type '- Review budget”, and save the file as 'notes.txt' on the Desktop.",
236
+ "List all files and directories in the current directory, including hidden ones, using a single command.",
237
+ "Go to weather.com and find the 5-day forecast for New York City.",
238
+ "Open LibreOffice Writer, create a new blank document, type the text 'Hello, this is a test document.', and save it as 'test_document.odt” on the desktop.",
239
+ "Click and drag to draw a rectangular selection around the text 'Hello World' on the screen.",
240
+ "Open a terminal and run the command: `mkdir -p ~/test_folder && echo 'Hello, World!' > ~/test_folder/greeting.txt`",
241
+ "Create a new directory named 'Automated_Backups' in the current user's home directory.",
242
+ "Visit https://www.imdb.com and search for the movie 'Inception' to find its release year and director's name.",
243
+ "List all files in the current directory, including hidden ones, in long format.",
244
+ "Automate the process of moving all .txt files from the Downloads folder to a newly created 'TextFiles” folder within the same directory, using a single script or command in the terminal.",
245
+ "Go to news.ycombinator.com and scroll down to read the top 5 stories, then click the first story’s title to open it.",
246
+ "Create a new directory named 'Automation_Backup' on the desktop, then create a text file inside it named 'log.txt' containing the current date and time.",
247
+ "Navigate to https://www.weather.com and search for the current weather in New York City by entering 'New York City' into the search bar and selecting the top result.",
248
+ "Click and drag to select the text 'Hello World' on the desktop, then right-click and choose 'Copy'.",
249
+ "mkdir -p ~/Documents/Projects/{Alpha,Beta,Gamma} && touch ~/Documents/Projects/{Alpha,Beta,Gamma}/README.md",
250
+ "Automatically move all .log files from the Downloads directory to a newly created Logs directory in the home folder.",
251
+ "Create a new text file on the desktop named 'mousepad.txt' and open it for editing.",
252
+ "Create a new directory named 'backup' in the current user's home directory.",
253
+ "Click and drag to select the text 'Hello World” on the screen, then press Ctrl+C to copy it.",
254
+ "Go to wikipedia.org and search for 'Mars rover missions” to find a list of all NASA Mars rovers and their launch dates.",
255
+ "Navigate to https://www.weather.com and search for the current weather in Tokyo, Japan.",
256
+ "Create a new directory named 'AutomationBackup' on the desktop.",
257
+ "Create a new LibreOffice Writer document, insert the text 'Hello, World!', and save it as 'greeting.odt' on the desktop.",
258
+ "Create a new empty file named 'notes.txt' in the current directory.",
259
+ "Navigate to https://www.amazon.com and search for 'wireless headphones” using the search bar at the top of the page.",
260
+ "Create a directory named 'automated_tasks' in the home directory, then create a subdirectory 'logs' inside it, and finally create an empty file named 'task.log' inside the 'logs' directory.",
261
+ "Create a new text file on the desktop named 'Notes.txt' and write the current date and time at the top, followed by a blank line for future entries.",
262
+ "Go to https://news.ycombinator.com and scroll down to view the latest top stories, then click on the first article link to open it.",
263
+ "Create a new directory named 'AutomationTask' on the desktop, then create a text file inside it named 'README.txt' containing the line: 'This is an automated task.'",
264
+ "Create a new LibreOffice Writer document, type 'Automated Task Completed.' on the first line, save it as 'automation_test.odt” on the desktop, and close the application.",
265
+ "Open LibreOffice Writer, create a new blank document, type 'Automated Task: Document Created Successfully', save the document as 'AutomationTest.odt' on the Desktop, then close LibreOffice Writer.",
266
+ "Navigate to https://www.wikipedia.org and search for 'Artificial Intelligence' using the main search bar, then click the first search result to open the Wikipedia article.",
267
+ "Create a new directory named 'project_backup' in the current working directory.",
268
+ "Go to news.ycombinator.com and scroll down to read the top 5 stories, then click the 'more” link at the bottom to load additional posts.",
269
+ "Open the Mousepad text editor, type 'Meeting notes:' followed by a new line, and save the file as 'notes.txt' on the desktop.",
270
+ "Open the mousepad application, type 'Meeting notes: Discuss project timeline and assign tasks”, then save the file as 'meeting_notes.txt' on the desktop.",
271
+ "Visit wikipedia.org and search for 'quantum computing” in the main search bar, then click the first search result to open the article.",
272
+ "Open LibreOffice Writer, create a new blank document, type the following text: 'Automation Task Completed Successfully”, then save the document as 'AutomationReport.odt” on your desktop.",
273
+ "Automate the creation of a new directory named 'Backup” in your current working directory, then move all .txt files from the current directory into the 'Backup” folder.",
274
+ "Visit https://www.amazon.com and search for 'wireless headphones' in the search bar, then press Enter to view the results.",
275
+ "Create a new directory named 'Backup' in the current working directory if it does not already exist.",
276
+ "Go to weather.com and check the current temperature in New York City.",
277
+ "Navigate to https://www.weather.com and search for the current weather in Tokyo, Japan by entering 'Tokyo' into the search bar and selecting the correct result.",
278
+ "Visit wikipedia.org and search for 'artificial intelligence' in the search bar, then click the first result to open the main article.",
279
+ "Visit wikipedia.org and search for 'quantum computing” in the search bar, then click the first result titled 'Quantum computing” to open the article.",
280
+ "Open LibreOffice Writer, create a new blank document, type the text 'Automated Task: Document created by desktop automation agent.', then save the document as 'automation_report.odt' on the desktop.",
281
+ "Open a blank text document and type 'Meeting Notes: [Date]' at the top, then leave space below for future entries — save the file as 'Notes.txt' on the desktop.",
282
+ "Open https://www.google.com and search for 'best practices for remote work'.",
283
+ "Open LibreOffice Writer, create a new blank document, type 'Automated Task Completed Successfully.', save the document as 'task_result.odt' on the desktop, then close LibreOffice.",
284
+ "Create a new directory named 'Documents' in the user's home folder.",
285
+ "Visit weather.com and check the 10-day forecast for Tokyo, Japan.",
286
+ "Click and drag from the top-left corner to the bottom-right corner of the screen to capture the entire desktop area.",
287
+ "Open the terminal and create a new directory named 'test_folder” in the current user’s home directory.",
288
+ "Create a new directory named 'Automated_Tasks” in your home directory, then inside it create three empty files: 'task1.txt', 'task2.txt', and 'task3.txt'.",
289
+ "mkdir -p ~/Desktop/Automation/{Input,Output,Logs} && touch ~/Desktop/Automation/Logs/$(date +%Y%m%d_%H%M%S).log",
290
+ "Create a new directory named 'backup_2024' in the user's home directory.",
291
+ "Navigate to https://www.google.com and search for 'best practices for web scraping in Python', then click the first search result.",
292
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, this is an automated test.', and save it as 'automated_test.odt' on the desktop.",
293
+ "Create a new LibreOffice Writer document, type 'Automated Task Completed.', and save it as 'auto_report.odt' on the desktop.",
294
+ "Go to https://www.weather.com and search for the current weather in Tokyo, Japan, then extract the temperature and forecast conditions displayed on the page.",
295
+ "Open LibreOffice Writer, create a new blank document, type 'Automated Task Completed Successfully.', save the document as 'automation_result.odt' on the desktop, then close LibreOffice Writer.",
296
+ "Open LibreOffice Writer, create a new blank document, type 'Automated Task Completed.', save it as 'automation_test.odt” on the desktop, then close LibreOffice Writer.",
297
+ "ls -la /tmp",
298
+ "Create a new directory named 'Automation_Tasks' in your home directory, then inside it create three subdirectories: 'Incoming', 'Processed', and 'Archived'.",
299
+ "Create a new LibreOffice Writer document, insert the text 'Automated Task: This document was generated via automation.' at the beginning, and save it as 'automated_document.odt” on the desktop.",
300
+ "Create a new directory named 'automation_task', navigate into it, create a file named 'script.sh' containing the line `echo 'Hello from automation!'`, make the script executable, and run it.",
301
+ "Open a new text document, type 'Meeting Notes: [current date]', save it as 'Notes.txt' on the desktop, and keep it open for editing.",
302
+ "Create a new text file on the desktop named 'Notes.txt' and open it for editing.",
303
+ "Open the mousepad application, type 'Meeting notes: Discuss project timeline and budget', and save the file as 'meeting_notes.txt' on the desktop.",
304
+ "Navigate to weather.com and search for the current weather forecast in Tokyo, Japan.",
305
+ "Create a new LibreOffice Writer document, insert the text 'Automated Task Completed.' at the top, and save it as 'automation_result.odt” on the desktop.",
306
+ "Click and drag to draw a rectangular selection on the desktop background, starting from the top-left corner of the screen and ending at the bottom-right corner.",
307
+ "Create a new directory named 'Automated_Backups' in the user's home folder, then create a subdirectory inside it called 'Daily' and set its permissions to 755.",
308
+ "Open a new blank text document and type 'Note:' at the top, then wait for further instructions to add content.",
309
+ "Create a new directory named 'project_backup' on the desktop, then copy all .txt files from the Documents folder into this new directory.",
310
+ "Go to weather.com and find the current temperature and forecast for New York City.",
311
+ "Create a new text file named 'notes.txt' on the desktop and open it for editing, ready to record observations or tasks.",
312
+ "Write 'Meeting Notes: [current date]' in the top-left corner of the mousepad area.",
313
+ "Create a new directory named 'Automation_Tasks” in your home directory, then inside it, create three empty files: 'task1.txt', 'task2.txt', and 'task3.txt'.",
314
+ "Create a new empty file named 'placeholder.txt' in the current directory.",
315
+ "Create a new directory named 'Documents' in the current user's home directory.",
316
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, World!' at the top, save the document as 'greeting.odt' on the desktop, and then close LibreOffice.",
317
+ "Open LibreOffice Writer, create a new blank document, type 'Hello, this is an automated test.', save it as 'automated_test.odt” on the desktop, then close the application.",
318
+ "Navigate to youtube.com and search for 'latest tech reviews' in the search bar, then press Enter to view the results.",
319
+ "Automatically move all .tmp files from the ~/Downloads directory to ~/Trash every day at 2 AM.",
320
+ "Create a new text file named 'mousepad.txt' on the desktop, open it, and type: 'Task completed: Mousepad note-taking initiated. No prior files used.' Then save and close the file.",
321
+ "Automatically create a new text file named 'Note_YYYYMMDD_HHMMSS.txt' on the desktop with the current date and time as its content.",
322
+ "Visit https://en.wikipedia.org/wiki/Main_Page and scroll down to the 'Did you know?' section to read the latest trivia.",
323
+ "Visit https://www.wikipedia.org and search for 'artificial intelligence' in the search bar, then click on the first result to open the corresponding article.",
324
+ "Create a directory named 'automation_task', then inside it, create a file named 'script.sh' containing the line: echo 'Automation complete.'; finally, make the script executable and run it.",
325
+ "Navigate to weather.com and enter 'New York” in the search bar to retrieve the current weather conditions for that location.",
326
+ "Create a new directory named 'my_folder' in the current working directory.",
327
+ "Open LibreOffice Writer, create a new blank document, type the following text: 'Automation Task Completed Successfully.', then save the document as 'Automation_Report.odt” on your desktop."
328
+ ]
cua2-core/src/cua2_core/services/archival_service.py CHANGED
@@ -29,6 +29,7 @@ logging.basicConfig(
29
  format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
30
  )
31
  logger = logging.getLogger(__name__)
 
32
 
33
 
34
  class ArchivalService:
 
29
  format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
30
  )
31
  logger = logging.getLogger(__name__)
32
+ logger.setLevel(logging.WARNING)
33
 
34
 
35
  class ArchivalService:
cua2-core/src/cua2_core/services/instruction_service.py CHANGED
@@ -1,175 +1,90 @@
 
1
  import logging
2
  import random
3
- import time
4
-
5
- from cua2_core.services.agent_utils.get_model import AVAILABLE_MODELS, get_model
6
- from smolagents import ChatMessage, Model
7
 
8
  logger = logging.getLogger(__name__)
 
9
 
10
 
11
  class InstructionService:
12
- """Service for generating task instructions using LLM models"""
13
-
14
- available_models = AVAILABLE_MODELS
15
- seed_topics = [
16
- "web browsing",
17
- "file management (linux)",
18
- "note-taking",
19
- "text/document editing (no existing document required, create a new one if needed, use libreoffice)",
20
- "terminal commands",
21
- ]
22
-
23
- prompt_templates = [
24
- (
25
- "Generate a clear and specific task instruction for a desktop automation agent. "
26
- "The task should involve {topic} and be completable using a desktop computer. "
27
- "Do not assume any pre-existing files, emails, or resources exist on the system. "
28
- "Return only the task instruction, nothing else. Keep it simple and focused on a single action."
29
- ),
30
- (
31
- "Create a practical task instruction for desktop automation related to {topic}. "
32
- "The task should be straightforward and achievable in one application. "
33
- "Do not reference specific files or resources that may not exist locally. "
34
- "Provide only the task description without any additional explanation."
35
- ),
36
- (
37
- "Generate a specific {topic} task that a desktop automation agent can perform. "
38
- "The task should be concrete and not require multiple applications. "
39
- "Avoid assuming pre-existing documents, files, or local resources. "
40
- "Return just the task instruction."
41
- ),
42
- (
43
- "Provide a single, clear task instruction involving {topic} for a desktop agent. "
44
- "The task should be simple and focused. "
45
- "Do not assume any specific files or resources already exist on the computer. "
46
- "Output only the instruction."
47
- ),
48
- (
49
- "Think of a realistic {topic} task suitable for desktop automation. "
50
- "Keep it simple and achievable in one application. "
51
- "The task should not depend on pre-existing local files or resources. "
52
- "Return only the task."
53
- ),
54
- ]
55
-
56
- web_browsing_templates = [
57
- (
58
- "Generate a clear and specific web browsing task instruction for a desktop automation agent. "
59
- "The task should be goal-centric, focused on retrieving information or performing an action online. "
60
- "Directly specify a URL or website to visit (e.g., 'Go to google.com and search for...'). "
61
- "Do NOT instruct the agent to open a browser application first - just specify the URL or web task directly. "
62
- "Return only the task instruction, nothing else. Keep it simple and focused on a single goal."
63
- ),
64
- (
65
- "Create a practical web browsing task for desktop automation. "
66
- "The task should focus on finding specific information or completing an online action. "
67
- "Include a specific URL or website name and what to do there (e.g., 'Visit github.com and...'). "
68
- "Do NOT include steps about opening a browser - just specify the web task directly. "
69
- "Provide only the task description without any additional explanation."
70
- ),
71
- (
72
- "Generate a specific web browsing task that a desktop automation agent can perform. "
73
- "The task should be about retrieving information or performing an action on a website. "
74
- "Specify URLs or web addresses directly (e.g., 'Navigate to wikipedia.org and...'). "
75
- "Do NOT mention opening a browser application - assume the agent will handle that automatically. "
76
- "Keep it concrete and single-purpose. Return just the task instruction."
77
- ),
78
- (
79
- "Provide a goal-oriented web browsing task instruction for a desktop agent. "
80
- "Focus on what information to find or what action to perform online. "
81
- "Specify a URL or website directly as part of the task (e.g., 'Go to amazon.com and...'). "
82
- "Do NOT instruct to open a browser first - just state the URL and the web task. "
83
- "Output only the instruction."
84
- ),
85
- (
86
- "Think of a realistic web browsing task suitable for desktop automation. "
87
- "The task should be about accessing online information or performing a web-based action. "
88
- "Include specific URLs or websites with the action to perform (e.g., 'Visit youtube.com and...'). "
89
- "Do NOT include opening a browser as a separate step - just specify the web task directly. "
90
- "Keep it simple and goal-focused. Return only the task."
91
- ),
92
- ]
93
-
94
- default_prompt = (
95
- "Generate a clear and specific task instruction for a desktop automation agent. "
96
- "The task should be something that can be completed using a desktop computer, "
97
- "such as opening applications, browsing websites, or manipulating files. "
98
- "Do not assume any pre-existing files, emails, or resources exist on the system. "
99
- "Return only the task instruction, nothing else. the instruction must be not to complexe and not multi-app task. "
100
  )
 
 
101
 
102
  @staticmethod
103
- def get_random_prompt() -> str:
104
- """
105
- Generate a random prompt by selecting a random topic and template.
106
- Uses special templates for web browsing that allow URL specification.
107
  """
108
- random.seed(time.time_ns())
109
-
110
- topic = random.choice(InstructionService.seed_topics)
111
-
112
- if topic == "web browsing":
113
- template = random.choice(InstructionService.web_browsing_templates)
114
- return template
115
 
116
- template = random.choice(InstructionService.prompt_templates)
117
- return template.format(topic=topic)
118
 
119
- @staticmethod
120
- def generate_instruction(
121
- model_id: str, prompt: str | None = None, use_random: bool = True
122
- ) -> str:
123
  """
124
- Generate a task instruction using the specified model
 
 
125
 
126
- Args:
127
- model_id: The ID of the model to use
128
- prompt: Optional custom prompt. If None, uses default or random prompt
129
- use_random: If True, uses random prompts for variety. If False, uses default prompt
130
- """
131
 
132
- if model_id not in InstructionService.available_models:
133
- available_models_str = ", ".join(InstructionService.available_models)
134
- raise ValueError(
135
- f"Invalid model_id '{model_id}'. Must be one of: {available_models_str}"
136
  )
137
 
138
  try:
139
- logger.info(f"Generating instruction with model: {model_id}")
140
-
141
- model: Model = get_model(model_id)
142
 
143
- if prompt:
144
- generation_prompt = prompt
145
- elif use_random:
146
- generation_prompt = InstructionService.get_random_prompt()
147
- else:
148
- generation_prompt = InstructionService.default_prompt
149
 
150
- instruction = model([ChatMessage(role="user", content=generation_prompt)])
 
151
  logger.info(
152
- f"Successfully generated instruction with {model_id}: {instruction.content[:100]}..."
153
  )
154
- return instruction.content
155
 
156
- except Exception as e:
157
- logger.error(f"Error generating instruction with {model_id}: {str(e)}")
158
- raise Exception(f"Failed to generate instruction: {str(e)}")
159
 
160
  @staticmethod
161
- def get_available_models() -> list[str]:
162
- """Get the list of available model IDs"""
163
- return InstructionService.available_models
164
 
165
- @staticmethod
166
- def get_random_topic() -> str:
167
- """Get a random topic from the seed topics"""
168
- return random.choice(InstructionService.seed_topics)
 
 
 
 
 
 
 
 
 
169
 
170
 
171
  if __name__ == "__main__":
172
- instruction = InstructionService.generate_instruction(
173
- model_id="Qwen/Qwen3-VL-8B-Instruct"
174
- )
175
  print(instruction)
 
1
+ import json
2
  import logging
3
  import random
4
+ from pathlib import Path
 
 
 
5
 
6
  logger = logging.getLogger(__name__)
7
+ logger.setLevel(logging.WARNING)
8
 
9
 
10
  class InstructionService:
11
+ """Service for loading task instructions from pregenerated pool"""
12
+
13
+ # Path to the pregenerated instructions file
14
+ INSTRUCTIONS_FILE_PATH = (
15
+ Path(__file__).parent
16
+ / "agent_utils"
17
+ / "instruction_utils"
18
+ / "pregenerated_instructions.json"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  )
20
+ # Cache for loaded instructions
21
+ _pregenerated_instructions: list[str] | None = None
22
 
23
  @staticmethod
24
+ def _load_pregenerated_instructions() -> list[str]:
 
 
 
25
  """
26
+ Load pregenerated instructions from the JSON file.
27
+ Uses lazy loading and caching to avoid repeated file reads.
 
 
 
 
 
28
 
29
+ Returns:
30
+ List of pregenerated instruction strings
31
 
32
+ Raises:
33
+ FileNotFoundError: If the pregenerated instructions file doesn't exist
34
+ json.JSONDecodeError: If the file contains invalid JSON
 
35
  """
36
+ # Return cached instructions if already loaded
37
+ if InstructionService._pregenerated_instructions is not None:
38
+ return InstructionService._pregenerated_instructions
39
 
40
+ file_path = InstructionService.INSTRUCTIONS_FILE_PATH
 
 
 
 
41
 
42
+ if not file_path.exists():
43
+ raise FileNotFoundError(
44
+ f"Pregenerated instructions file not found at {file_path}. "
45
+ f"Please ensure the file exists."
46
  )
47
 
48
  try:
49
+ with open(file_path, "r", encoding="utf-8") as f:
50
+ instructions = json.load(f)
 
51
 
52
+ if not isinstance(instructions, list):
53
+ raise ValueError(
54
+ f"Invalid format in pregenerated instructions file. Expected a list, got {type(instructions)}"
55
+ )
 
 
56
 
57
+ # Cache the instructions
58
+ InstructionService._pregenerated_instructions = instructions
59
  logger.info(
60
+ f"Loaded {len(instructions)} pregenerated instructions from {file_path}"
61
  )
62
+ return instructions
63
 
64
+ except json.JSONDecodeError as e:
65
+ logger.error(f"Failed to parse JSON from {file_path}: {str(e)}")
66
+ raise
67
 
68
  @staticmethod
69
+ def get_random_instruction() -> str:
70
+ """
71
+ Get a random instruction from the pregenerated pool.
72
 
73
+ Returns:
74
+ A random instruction string
75
+
76
+ Raises:
77
+ FileNotFoundError: If the pregenerated instructions file doesn't exist
78
+ IndexError: If the pregenerated instructions list is empty
79
+ """
80
+ instructions = InstructionService._load_pregenerated_instructions()
81
+
82
+ if not instructions:
83
+ raise IndexError("Pregenerated instructions list is empty")
84
+
85
+ return random.choice(instructions)
86
 
87
 
88
  if __name__ == "__main__":
89
+ instruction = InstructionService.get_random_instruction()
 
 
90
  print(instruction)
cua2-core/src/cua2_core/services/simulation_metadata/simulated_trace.json DELETED
@@ -1,61 +0,0 @@
1
- {
2
- "steps": [
3
- {
4
- "stepId": "step_001",
5
- "image": "images/step_1.png",
6
- "thought": "I can see a form with multiple input fields. I need to start by clicking on the first name field to begin filling out the form.",
7
- "actions": [
8
- {
9
- "actionType": "click",
10
- "actionArguments": {
11
- "x": 320,
12
- "y": 180
13
- }
14
- }
15
- ],
16
- "duration": 2.3,
17
- "inputTokensUsed": 1250,
18
- "outputTokensUsed": 85,
19
- "timestamp": "2025-10-17T14:30:02.300Z",
20
- "step_evaluation": "like"
21
- },
22
- {
23
- "stepId": "step_002",
24
- "image": "images/step_2.png",
25
- "thought": "After clicking the first field, I can see the cursor is active. Now I should proceed to click on the email field to continue with the form submission process.",
26
- "actions": [
27
- {
28
- "actionType": "click",
29
- "actionArguments": {
30
- "x": 420,
31
- "y": 285
32
- }
33
- }
34
- ],
35
- "duration": 1.8,
36
- "inputTokensUsed": 1180,
37
- "outputTokensUsed": 72,
38
- "timestamp": "2025-10-17T14:30:04.100Z",
39
- "step_evaluation": "like"
40
- },
41
- {
42
- "stepId": "step_003",
43
- "image": "images/step_3.png",
44
- "thought": "The form appears to be mostly filled. I can see a submit button at the bottom of the form. I'll click on it to complete the form submission.",
45
- "actions": [
46
- {
47
- "actionType": "click",
48
- "actionArguments": {
49
- "x": 450,
50
- "y": 520
51
- }
52
- }
53
- ],
54
- "duration": 1.5,
55
- "inputTokensUsed": 1100,
56
- "outputTokensUsed": 68,
57
- "timestamp": "2025-10-17T14:30:05.600Z",
58
- "step_evaluation": "like"
59
- }
60
- ]
61
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cua2-core/tests/test_routes.py CHANGED
@@ -1,4 +1,4 @@
1
- from unittest.mock import Mock, patch
2
 
3
  import pytest
4
  from cua2_core.models.models import AvailableModelsResponse, UpdateStepResponse
@@ -284,53 +284,6 @@ class TestUpdateTraceStep:
284
  assert update_response.message == "Step updated successfully"
285
 
286
 
287
- class TestGenerateInstruction:
288
- """Test suite for POST /generate-instruction endpoint"""
289
-
290
- @patch("cua2_core.routes.routes.InstructionService.generate_instruction")
291
- def test_generate_instruction_success(self, mock_generate, client):
292
- """Test successful instruction generation with mocked model"""
293
- # Mock the instruction generation
294
- mock_instruction = "Open Google Chrome and navigate to example.com"
295
- mock_generate.return_value = mock_instruction
296
-
297
- request_data = {
298
- "model_id": "Qwen/Qwen3-VL-8B-Instruct",
299
- "prompt": "Generate a web browsing task",
300
- }
301
-
302
- response = client.post("/generate-instruction", json=request_data)
303
-
304
- assert response.status_code == 200
305
- data = response.json()
306
-
307
- assert data["instruction"] == mock_instruction
308
- assert data["model_id"] == request_data["model_id"]
309
-
310
- # Verify the service was called correctly
311
- mock_generate.assert_called_once_with(
312
- model_id=request_data["model_id"], prompt=request_data["prompt"]
313
- )
314
-
315
- @patch("cua2_core.routes.routes.InstructionService.generate_instruction")
316
- def test_generate_instruction_invalid_model(self, mock_generate, client):
317
- """Test instruction generation with invalid model_id"""
318
- # Mock the service to raise ValueError for invalid model
319
- mock_generate.side_effect = ValueError(
320
- "Invalid model_id 'invalid-model'. Must be one of: Qwen/Qwen3-VL-2B-Instruct, ..."
321
- )
322
-
323
- request_data = {
324
- "model_id": "invalid-model",
325
- "prompt": "Generate a task",
326
- }
327
-
328
- response = client.post("/generate-instruction", json=request_data)
329
-
330
- assert response.status_code == 400
331
- assert "Invalid model_id" in response.json()["detail"]
332
-
333
-
334
  class TestRoutesIntegration:
335
  """Integration tests for multiple routes"""
336
 
 
1
+ from unittest.mock import Mock
2
 
3
  import pytest
4
  from cua2_core.models.models import AvailableModelsResponse, UpdateStepResponse
 
284
  assert update_response.message == "Step updated successfully"
285
 
286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  class TestRoutesIntegration:
288
  """Integration tests for multiple routes"""
289
 
cua2-front/src/components/WelcomeScreen.tsx CHANGED
@@ -70,7 +70,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ onStartTask, isCon
70
 
71
  setIsGeneratingQuestion(true);
72
  try {
73
- const randomTask = await generateRandomQuestion(selectedModelId);
74
 
75
  // Clear current text
76
  setCustomTask('');
@@ -89,7 +89,7 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ onStartTask, isCon
89
  }
90
  setIsTyping(false);
91
  }
92
- }, 30); // 30ms per character
93
  } catch (error) {
94
  console.error('Failed to generate question:', error);
95
  setIsTyping(false);
 
70
 
71
  setIsGeneratingQuestion(true);
72
  try {
73
+ const randomTask = await generateRandomQuestion();
74
 
75
  // Clear current text
76
  setCustomTask('');
 
89
  }
90
  setIsTyping(false);
91
  }
92
+ }, 10); // 10ms per character
93
  } catch (error) {
94
  console.error('Failed to generate question:', error);
95
  setIsTyping(false);
cua2-front/src/services/api.ts CHANGED
@@ -15,15 +15,12 @@ export async function fetchAvailableModels(): Promise<string[]> {
15
  /**
16
  * Generate a random instruction from the backend
17
  */
18
- export async function generateRandomQuestion(modelId: string): Promise<string> {
19
  const response = await fetch(`${getApiBaseUrl()}/generate-instruction`, {
20
  method: 'POST',
21
  headers: {
22
  'Content-Type': 'application/json',
23
  },
24
- body: JSON.stringify({
25
- model_id: modelId,
26
- }),
27
  });
28
  if (!response.ok) {
29
  throw new Error('Failed to generate instruction');
 
15
  /**
16
  * Generate a random instruction from the backend
17
  */
18
+ export async function generateRandomQuestion(): Promise<string> {
19
  const response = await fetch(`${getApiBaseUrl()}/generate-instruction`, {
20
  method: 'POST',
21
  headers: {
22
  'Content-Type': 'application/json',
23
  },
 
 
 
24
  });
25
  if (!response.ok) {
26
  throw new Error('Failed to generate instruction');