-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.py
More file actions
196 lines (151 loc) · 4.85 KB
/
examples.py
File metadata and controls
196 lines (151 loc) · 4.85 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
"""
Example scripts for See-Think-Act Agent
Run these examples to test the agent with different tasks
"""
from see_think_act_agent import SeeThinkActAgent
import json
def example_1_simple_notepad():
"""Example 1: Open Notepad and type text"""
print("\n" + "=" * 80)
print("EXAMPLE 1: Open Notepad and Type Text")
print("=" * 80)
agent = SeeThinkActAgent(
model="qwen3-vl:235b-cloud",
max_iterations=20,
save_screenshots=True
)
task = "Open Notepad and type 'Hello from the See-Think-Act AI Agent!'"
print(f"\nTask: {task}\n")
result = agent.run(task)
print("\nResult:")
print(json.dumps(result, indent=2))
def example_2_calculator():
"""Example 2: Use Calculator"""
print("\n" + "=" * 80)
print("EXAMPLE 2: Use Calculator")
print("=" * 80)
agent = SeeThinkActAgent(
model="qwen3-vl:235b-cloud",
max_iterations=30,
save_screenshots=True
)
task = "Open Calculator and calculate 10 + 15"
print(f"\nTask: {task}\n")
result = agent.run(task)
print("\nResult:")
print(json.dumps(result, indent=2))
def example_3_file_explorer():
"""Example 3: Open File Explorer"""
print("\n" + "=" * 80)
print("EXAMPLE 3: Open File Explorer")
print("=" * 80)
agent = SeeThinkActAgent(
model="qwen3-vl:235b-cloud",
max_iterations=15,
save_screenshots=True
)
task = "Open File Explorer"
print(f"\nTask: {task}\n")
result = agent.run(task)
print("\nResult:")
print(json.dumps(result, indent=2))
def example_4_web_browser():
"""Example 4: Open Web Browser"""
print("\n" + "=" * 80)
print("EXAMPLE 4: Open Web Browser")
print("=" * 80)
agent = SeeThinkActAgent(
model="qwen3-vl:235b-cloud",
max_iterations=25,
save_screenshots=True
)
task = "Open Google Chrome browser. Open new tab and go to chatgpt.com. Ask it 'What is the capital of France?'"
print(f"\nTask: {task}\n")
result = agent.run(task)
print("\nResult:")
print(json.dumps(result, indent=2))
def example_5_custom_task():
"""Example 5: Custom Task (modify as needed)"""
print("\n" + "=" * 80)
print("EXAMPLE 5: Custom Task")
print("=" * 80)
agent = SeeThinkActAgent(
model="qwen3-vl:235b-cloud",
max_iterations=30,
save_screenshots=True
)
# Customize your task here
task = "Open Settings"
print(f"\nTask: {task}\n")
result = agent.run(task)
print("\nResult:")
print(json.dumps(result, indent=2))
def run_all_examples():
"""Run all examples sequentially"""
print("\n" + "=" * 80)
print("RUNNING ALL EXAMPLES")
print("=" * 80)
print("\nThis will run all example tasks sequentially.")
print("Press Ctrl+C at any time to stop.\n")
input("Press Enter to continue...")
examples = [
example_1_simple_notepad,
example_2_calculator,
example_3_file_explorer,
example_4_web_browser,
]
for i, example in enumerate(examples, 1):
print(f"\n\n{'=' * 80}")
print(f"Running Example {i}/{len(examples)}")
print('=' * 80)
try:
example()
except KeyboardInterrupt:
print("\n\nExecution interrupted by user.")
break
except Exception as e:
print(f"\n\nError in example: {e}")
continue
if i < len(examples):
input("\nPress Enter to continue to next example...")
print("\n\n" + "=" * 80)
print("ALL EXAMPLES COMPLETED")
print("=" * 80)
def main():
"""Main entry point"""
print("\n" + "=" * 80)
print("SEE-THINK-ACT AI AGENT - EXAMPLES")
print("=" * 80)
print("\nAvailable Examples:")
print(" 1. Open Notepad and type text")
print(" 2. Use Calculator")
print(" 3. Open File Explorer")
print(" 4. Open Web Browser")
print(" 5. Custom task")
print(" 6. Run all examples")
print(" 0. Exit")
while True:
print("\n" + "-" * 80)
choice = input("\nSelect an example (0-6): ").strip()
if choice == "0":
print("\nGoodbye!")
break
elif choice == "1":
example_1_simple_notepad()
elif choice == "2":
example_2_calculator()
elif choice == "3":
example_3_file_explorer()
elif choice == "4":
example_4_web_browser()
elif choice == "5":
example_5_custom_task()
elif choice == "6":
run_all_examples()
else:
print("\nInvalid choice. Please select 0-6.")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\n\nExecution interrupted by user. Goodbye!")