OpenSteer’s Computer Use Agent (CUA) allows you to control browsers using natural language instructions. The agent uses vision-language models to understand page content and execute actions autonomously.
const result = await agent.execute({ instruction: 'Find the top 3 products on this page and click the first one', maxSteps: 30, highlightCursor: true})
The execute() method returns a detailed result object:
interface OpensteerAgentResult { success: boolean // Whether execution completed without errors completed: boolean // Whether the task was completed message: string // Final message from the agent actions: OpensteerAgentAction[] // List of actions taken usage?: OpensteerAgentUsage // Token and time usage provider: string // Provider used (openai, anthropic, google) model: string // Model used}
interface OpensteerAgentAction { type: string // Action type: click, type, scroll, etc. reasoning?: string // Agent's reasoning for this action button?: string // Mouse button (for clicks) clickCount?: number // Number of clicks x?: number // X coordinate y?: number // Y coordinate text?: string // Text to type keys?: string[] // Keys pressed scrollX?: number // Horizontal scroll amount scrollY?: number // Vertical scroll amount timeMs?: number // Time taken for action url?: string // URL (for navigation) path?: Array<{ x: number; y: number }> // Mouse movement path}
The usage object provides token and performance metrics:
interface OpensteerAgentUsage { inputTokens: number // Input tokens consumed outputTokens: number // Output tokens generated reasoningTokens?: number // Reasoning tokens (if applicable) inferenceTimeMs: number // Total inference time in milliseconds}
// Simple taskconst result = await agent.execute({ instruction: 'Click the login button', maxSteps: 5})// Complex taskconst result = await agent.execute({ instruction: 'Fill out the entire registration form', maxSteps: 30})
Set maxSteps based on task complexity to prevent runaway executions.
Use highlightCursor for debugging
const result = await agent.execute({ instruction: 'Navigate through the menu', highlightCursor: true // Shows red cursor indicator})
Enable cursor highlighting to visually track agent actions during development.
Provide clear instructions
// Good - specific and clearconst result = await agent.execute( 'Go to the pricing page, find the Enterprise plan, and click the contact sales button')// Bad - vagueconst result = await agent.execute('do something')
Clear instructions help the agent understand and complete tasks efficiently.
Check result status
const result = await agent.execute('Complete the task')if (result.success && result.completed) { console.log('Task completed successfully')} else if (result.success && !result.completed) { console.log('Agent ran out of steps') console.log('Consider increasing maxSteps')} else { console.error('Error occurred:', result.message)}
Always check both success and completed to understand the outcome.
Customize system prompts for specific domains
const agent = opensteer.agent({ mode: 'cua', systemPrompt: `You are a product research assistant. When finding products, always check: 1. Price 2. Ratings 3. Availability Prioritize highly-rated items.`})
Custom prompts help the agent follow domain-specific rules.