Skip to content

OS & Browser Control

OS and browser control is how your AI agent interacts with the cloud desktop environment. CodecFlow provides comprehensive control over both the operating system and web browsers, handling common challenges like CAPTCHAs and anti-bot measures automatically.

const browser = await desktop.createBrowser();
// Navigation
await browser.navigate('https://example.com');
// Interactions
await browser.click('#button');
await browser.type('#input', 'Hello');
await browser.scroll(500);
// Content Extraction
const text = await browser.getText('#content');
const image = await browser.screenshot();
  • Some websites may detect automated browsing
  • CAPTCHAs are handled automatically but may occasionally fail
  • Rate limiting might apply based on your plan
// Example: Handling navigation errors
try {
await browser.navigate('https://example.com');
} catch (error) {
if (error.code === 'CAPTCHA_FAILED') {
await browser.retryWithNewProxy();
}
}

CodecFlow provides direct access to operating system functionality, enabling automation of desktop applications and system tasks.

// Launch a desktop application
const app = await desktop.launchApplication('notepad.exe');
// Interact with GUI elements
await app.click({text: 'File'});
await app.click({text: 'Save'});
await app.type('My Document');
await app.click({text: 'Save'});
// Get application state
const windowTitle = await app.getWindowTitle();
const isResponding = await app.isResponding();
// Access the file system
const fs = desktop.fileSystem;
// Basic file operations
await fs.writeFile('/path/to/file.txt', 'Hello World');
const content = await fs.readFile('/path/to/file.txt');
await fs.copyFile('/source/file.txt', '/destination/file.txt');
await fs.deleteFile('/path/to/file.txt');
// Directory operations
const files = await fs.listDirectory('/path/to/dir');
await fs.createDirectory('/path/to/newdir');
// Execute system commands
const result = await desktop.executeCommand('ipconfig /all');
console.log(result.stdout);
// Run PowerShell/Bash scripts
const scriptResult = await desktop.executeScript({
type: 'powershell', // or 'bash', 'cmd', etc.
content: 'Get-Process | Where-Object {$_.CPU -gt 10}'
});