Skip to content

Workflow 001: AI Agent Web Automation

Fresh

Overview

Build an AI agent that can browse the web, interact with sites, bypass anti-bot measures, and extract data using Steel's browser infrastructure.

Architecture

Supported Frameworks

FrameworkLanguageTemplate
Browser UsePythonsteel forge browser-use
StagehandTypeScriptsteel forge stagehand
Claude Computer UseTypeScriptsteel forge claude-cua
OpenAI Computer UseTypeScriptsteel forge oai-cua
CrewAIPythonsteel forge crewai
MagnitudeTypeScriptsteel forge magnitude

Step-by-Step Implementation

Step 1: Set Up Project

bash
# Using Steel CLI
steel forge browser-use --name my-agent

# Or manually
npm install steel-sdk playwright

Step 2: Create Configured Session

typescript
import Steel from 'steel-sdk';

const client = new Steel({
  steelAPIKey: process.env.STEEL_API_KEY,
});

const session = await client.sessions.create({
  useProxy: true,         // Residential proxy
  solveCaptcha: true,     // Auto CAPTCHA solving
  timeout: 1800000,       // 30 minutes
});

console.log(`Live view: ${session.sessionViewerUrl}`);

Step 3: Connect Automation Tool

typescript
import { chromium } from 'playwright';

const browser = await chromium.connectOverCDP(
  `wss://connect.steel.dev?apiKey=${process.env.STEEL_API_KEY}&sessionId=${session.id}`
);

const page = browser.contexts()[0].pages()[0];

Step 4: AI Agent Loop

typescript
async function agentLoop(page, task) {
  await page.goto(task.url);
  await page.waitForNetworkIdle();

  // Extract page content for LLM
  const content = await page.content();

  // Send to LLM for decision making
  // LLM returns next actions (click, type, navigate, extract)

  // Execute actions
  // Repeat until task complete
}

Step 5: Clean Up

typescript
await browser.close();
await client.sessions.release(session.id);

Best Practices

  1. Use session viewer for debugging: session.sessionViewerUrl
  2. Set appropriate timeouts for complex tasks
  3. Enable proxy + CAPTCHA for production scraping
  4. Reuse profiles for sites requiring login
  5. Implement error handling with session cleanup in finally blocks

See Also

SOP Documentation Hub - Built from Steel.dev Official Docs