Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
#!/usr/bin/env python3
"""Entry point for {{agent_name}} agent container.
This module is called when running the agent in a Docker container.
It implements the CUA agent protocol for communication with the runner.
"""
import asyncio
import json
import os
import sys
from pathlib import Path
from agent import {{class_name}}
async def main():
"""Run the agent with parameters from environment."""
# Read configuration from environment
task_description = os.environ.get("CUA_TASK_DESCRIPTION", "")
session_url = os.environ.get("CUA_SESSION_URL", "")
logging_dir = os.environ.get("CUA_LOGGING_DIR")
if not task_description:
print("Error: CUA_TASK_DESCRIPTION not set", file=sys.stderr)
sys.exit(1)
if not session_url:
print("Error: CUA_SESSION_URL not set", file=sys.stderr)
sys.exit(1)
# Create logging directory if specified
log_path = Path(logging_dir) if logging_dir else None
if log_path:
log_path.mkdir(parents=True, exist_ok=True)
# Create and run agent
agent = {{class_name}}()
# Import session connection (provided by cua-bench)
from cua_bench.session import connect_session
async with connect_session(session_url) as session:
result = await agent.perform_task(
task_description=task_description,
session=session,
logging_dir=log_path,
)
# Output result as JSON
print(json.dumps({
"total_input_tokens": result.total_input_tokens,
"total_output_tokens": result.total_output_tokens,
"failure_mode": result.failure_mode.value if result.failure_mode else None,
}))
if __name__ == "__main__":
asyncio.run(main())