Dự đoán
Computer Use: AI chụp màn hình, hiểu layout, click vào đúng vị trí, gõ phím điền form — như thuê người nhưng nhanh hơn 10x và 24/7. Không cần API, không cần scraper. Hoạt động với MỌI website vì tương tác như con người!
Evaluating routing across providers.
AI Builder
Khả năng AI Agent điều khiển giao diện người dùng — click, gõ phím, chụp ảnh màn hình
Computer Use: AI chụp màn hình, hiểu layout, click vào đúng vị trí, gõ phím điền form — như thuê người nhưng nhanh hơn 10x và 24/7. Không cần API, không cần scraper. Hoạt động với MỌI website vì tương tác như con người!
Một vòng see() → think() → act()
Chụp màn hình và đọc layout hiện tại.
API integration (qua function calling): cần developer build cho TỪNG app. Computer Use: AI dùng app như con người — hoạt động với MỌI app có giao diện, kể cả legacy software 20 năm tuổi không có API. Đây là một biến thể đặc biệt của kiến trúc agent mà "tool" duy nhất là chuột và bàn phím. Giống thuê người làm việc nhưng 24/7, không mệt, không sai vì mỏi.
Điểm bất ngờ lớn nhất: cùng một agent điều khiển được bất kỳ app nào — từ Excel cổ đời 2003 đến SaaS mới nhất — chỉ vì ai cũng gửi pixel về cùng một VLM. Khả năng "generalize" này là thứ API integration không bao giờ đạt được.
Visual prompt injection: nội dung trên màn hình có thể 'lừa' AI làm điều không mong muốn. Giải pháp: (1) Sandbox environment (máy ảo), (2) Permission controls (không cho click link lạ), (3) Human approval cho sensitive actions, (4) URL whitelist.
Khi có thể, ưu tiên keyboard shortcut thay vì click. Tab chuyển field ổn định hơn click (không bị miss do resize, không cần round-trip thêm 1 screenshot). VLM càng ít lần phải 'nhìn' lại, latency càng thấp. Đây là tối ưu Anthropic gợi ý trong cookbook.
Computer Use cho phép AI agent điều khiển máy tính như con người — chụp màn hình, click, gõ phím, scroll. Nó biến một VLM thành một "virtual office worker" có thể dùng bất kỳ app nào trên desktop.
Vòng lặp chính (perception-action loop):
3 khả năng chính:
Tool computer_20250124 của Anthropic cung cấp các action primitive sau:
screenshot — trả về PNG của màn hìnhmouse_move(x, y) — di chuộtleft_click(x, y), right_click(x, y), double_click(x, y)type(text) — gõ chuỗi ký tựkey(xdotool_keystroke) — ví dụ "ctrl+l", "Return"scroll, left_click_drag, cursor_positionhold_key, wait — synchronize với UI asyncModel tự quyết định gọi action nào và với tham số gì trong mỗi turn. Server-side execute rồi trả screenshot mới về.
Anthropic khuyến nghị dùng resolution (theo nguồn bài, chưa kiểm chứng) 1280x800 cho tool. Nếu display thật khác, cần scale bilateral:
xdotool mousemove.XDG_SCALE=1 hoặc dùng logical pixels nhất quán.Sai scaling là bug silent — click trúng chỗ khác, task fail không explain được. Log lại screenshot + toạ độ để debug.
import anthropic
client = anthropic.Anthropic()
# AI điều khiển một Linux desktop trong Docker container
response = client.beta.messages.create(
model="claude-sonnet-4-5",
max_tokens=4096,
tools=[
{
"type": "computer_20250124",
"name": "computer",
"display_width_px": 1280,
"display_height_px": 800,
},
{
"type": "bash_20250124",
"name": "bash",
},
],
messages=[{
"role": "user",
"content": (
"Mở Firefox, vào https://en.wikipedia.org, "
"tìm 'Ada Lovelace', chụp screenshot trang kết quả và "
"lưu vào /tmp/ada.png"
),
}],
betas=["computer-use-2025-01-24"],
)
# Loop: model trả về tool_use block → ta execute
# → chụp screenshot → gửi lại cho model
for block in response.content:
if block.type == "tool_use":
name = block.name
inp = block.input
if name == "computer":
# dispatch: screenshot / left_click / type / key / scroll ...
action = inp["action"]
if action == "screenshot":
png_bytes = take_screenshot()
elif action == "left_click":
x, y = inp["coordinate"]
pyautogui.click(x, y)
elif action == "type":
pyautogui.typewrite(inp["text"])
elif action == "key":
pyautogui.hotkey(*inp["text"].split("+"))
# ... gửi tool_result với screenshot mớiimport anthropic, base64
from PIL import ImageGrab
client = anthropic.Anthropic()
messages = [{
"role": "user",
"content": "Mở file manager, tạo folder 'reports' trong ~/Documents",
}]
def screenshot_b64() -> str:
img = ImageGrab.grab()
img.thumbnail((1280, 800))
buf = io.BytesIO()
img.save(buf, format="PNG")
return base64.b64encode(buf.getvalue()).decode()
for turn in range(30): # safety cap
resp = client.beta.messages.create(
model="claude-sonnet-4-5",
max_tokens=2048,
tools=[{
"type": "computer_20250124",
"name": "computer",
"display_width_px": 1280,
"display_height_px": 800,
}],
betas=["computer-use-2025-01-24"],
messages=messages,
)
if resp.stop_reason == "end_turn":
break
tool_results = []
for blk in resp.content:
if blk.type == "tool_use":
action = blk.input.get("action")
# Execute action safely inside sandbox...
# Then capture new screenshot as evidence.
img_b64 = screenshot_b64()
tool_results.append({
"type": "tool_result",
"tool_use_id": blk.id,
"content": [
{"type": "image",
"source": {"type": "base64",
"media_type": "image/png",
"data": img_b64}}
],
})
messages.append({"role": "assistant", "content": resp.content})
messages.append({"role": "user", "content": tool_results})Liên hệ với các chủ đề khác : Computer Use là ứng dụng đỉnh cao của VLM và agent architecture. Nó chia sẻ nhiều kỹ thuật an toàn với agentic workflows — đặc biệt là permission gating và sandbox isolation.