Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/agi-inc_agisdk-js.json
T

1 line
30 KiB
JSON

{"repo": "agi-inc/agisdk-js", "files": {"example/README.md": {"65b8e90f877076e662af99cfba0c56da091c94c5": {"t": 1785747231.2968915, "n": 8306, "h": "5be2cac1409c2f08", "c": "# AGI SDK Examples\n\nThis directory contains example implementations demonstrating how to use the AGI SDK for building and testing web agents in TypeScript/JavaScript. Each example showcases different approaches to agent implementation and configuration.\n\n## Available Examples\n\n### 1. `starter.ts`\n\nThe simplest agent implementation that works with any model. This is the best starting point for beginners.\n\n**Features:**\n- Minimal implementation using the built-in DemoAgent\n- Multiple configuration options for flexibility\n- Easy to understand and modify\n- Works with OpenAI, Anthropic, and OpenRouter models\n\n**How to run:**\n```bash\n# Install dependencies\nnpm install\n\n# Set your API key\nexport OPENAI_API_KEY=\"your-api-key\" # or ANTHROPIC_API_KEY\n\n# Run with default settings\nnpx tsx example/starter.ts\n\n# Run with custom model or configuration\nnpx tsx example/starter.ts --model gpt-4o --task v2.omnizon-1 --headless false\n```\n\n### 2. `custom.ts`\n\nBoilerplate code for creating your own custom agent. Use this as a template when implementing your own agent logic.\n\n**Features:**\n- Basic structure for a custom agent implementation\n- Minimal code needed to get started\n- Clear instructions for extending functionality\n- TypeScript interfaces for type safety\n\n**How to run:**\n```bash\n# Run the custom agent example\nnpx tsx example/custom.ts\n```\n\n### 3. `hackable.ts`\n\nA more advanced, feature-rich agent implementation designed for others to use and improve. This is our recommended agent for most use cases.\n\n**Features:**\n- Detailed agent implementation with observation preprocessing\n- Support for different model backends (OpenAI, Anthropic, OpenRouter)\n- Configurable agent parameters via command-line arguments\n- Extensive documentation and examples\n- Leaderboard submission support\n\n**How to run:**\n```bash\n# Run with default configuration\nnpx tsx example/hackable.ts\n\n# Run with custom parameters\nnpx tsx example/hackable.ts \\\n --model gpt-4o \\\n --task v2.omnizon-1 \\\n --headless false \\\n --use-html true \\\n --use-axtree true \\\n --use-screenshot true \\\n --leaderboard true \\\n --run-id your-run-id\n```\n\n### 4. `leaderboard.ts`\n\nExample demonstrating how to submit results to the REAL benchmark leaderboard.\n\n**Features:**\n- Leaderboard submission configuration\n- Environment variable support\n- Result tracking and display\n\n**How to run:**\n```bash\n# Set environment variables\nexport REAL_API_KEY=\"your-api-key\"\nexport REAL_RUN_ID=\"your-run-id\"\nexport REAL_MODEL_NAME=\"gpt-4o\"\nexport REAL_RUN_NAME=\"my-test-run\"\nexport OPENAI_API_KEY=\"your-openai-key\"\n\n# Run the example\nnpx tsx example/leaderboard.ts\n\n# Or pass via command-line\nnpx tsx example/leaderboard.ts \\\n --api-key \"your-api-key\" \\\n --run-id \"your-run-id\" \\\n --model-name \"gpt-4o\" \\\n --run-name \"my-test-run\"\n```\n\n### 5. `run_simple.ts`\n\nRun multiple tasks in sequence to benchmark agent performance across different scenarios.\n\n**Features:**\n- Batch task execution\n- Performance tracking and statistics\n- Configurable task list\n\n**How to run:**\n```bash\n# Set your API key\nexport OPENAI_API_KEY=\"your-key\"\n\n# Run with default settings\nnpx tsx example/run_simple.ts\n\n# Run with custom model\nnpx tsx example/run_simple.ts --model gpt-4o\n```\n\n## Submitting Examples to the REAL Leaderboard\n\n1. **Create an API key** inside the portal (Profile → API Keys).\n2. **Get a run ID**:\n - From the portal UI: Profile → Create Run, then copy the `run_id` from the runs table.\n - Or via the API:\n ```bash\n curl \"https://www.realevals.ai/api/runKey?api_key=<API_KEY>&model_name=<MODEL>&run_name=<RUN>\"\n ```\n The `newRunId` field in the response is your run identifier. You can override the base domain by setting `REAL_API_BASE=https://...` before running the SDK.\n3. **Set environment variables** so the examples submit automatically:\n ```bash\n export REAL_API_KEY=<API_KEY>\n export REAL_RUN_ID=<newRunId>\n export REAL_MODEL_NAME=<MODEL>\n export REAL_RUN_NAME=<RUN>\n ```\n Skip these variables if you want to run locally without submitting.\n4. Run the example (e.g., `npx tsx example/leaderboard.ts`). The harness uses those values, sets `RUNID`, and the clone will forward results to the leaderboard. Inside the SDK reference tasks as `v2.omnizon-1`; when querying portal APIs use the bare id (`omnizon-1`).\n\n## Harness Configuration\n\nMost examples use the REAL harness, which accepts various configuration parameters:\n\n```typescript\nimport { REAL } from '@theagicompany/agisdk';\n\nconst harness = new REAL.Harness({\n // Agent configuration\n agent: new REAL.DemoAgent({\n modelName: 'gpt-4o', // OpenAI models\n // or 'sonnet-3.7' // Anthropic models\n // or 'openrouter/deepseek/deepseek-r1:free' // OpenRouter models\n useAxtree: true,\n useScreenshot: true,\n useHtml: false,\n }),\n\n // Task selection (provide one of these)\n taskName: 'v2.omnizon-1', // Specific task to run\n // taskType: 'omnizon', // Run all tasks of this type\n // taskId: 1, // Run specific task ID within a type\n\n // Browser configuration\n headless: false, // Whether to show the browser\n maxSteps: 25, // Maximum number of steps\n\n // Observation options\n useHtml: false, // Include HTML in observations\n useAxtree: true, // Include accessibility tree\n useScreenshot: true, // Include screenshots\n\n // Leaderboard submission\n leaderboard: false, // Whether to submit to leaderboard\n runId: 'my_unique_id', // Unique ID for the submission\n apiKey: 'your-api-key', // API key for leaderboard\n\n // Execution options\n // numWorkers: 4, // Number of parallel workers (future)\n});\n\n// Run tasks\nconst results = await harness.run();\n```\n\n## Creating Your Own Agent\n\nTo create your own agent:\n\n1. Implement the `Agent` interface:\n ```typescript\n class MyAgent implements REAL.Agent {\n async getAction(obs: Observation): Promise<string> {\n // Your agent logic here\n return \"click('123')\";\n }\n\n async close(): Promise<void> {\n // Optional cleanup\n }\n }\n ```\n\n2. Use your agent with the harness:\n ```typescript\n const harness = new REAL.Harness({\n agent: new MyAgent(),\n taskName: 'v2.omnizon-1',\n headless: false,\n });\n\n const results = await harness.run();\n ```\n\nSee the `MyCustomAgent` class in `custom.ts` or the `DemoAgent` class in the SDK source for implementation examples.\n\n## Using Different Models\n\nThe AGI SDK supports various model providers through the `DemoAgent`:\n\n- **OpenAI**: Set `modelName: 'gpt-4o'` or other OpenAI models\n- **Anthropic**: Set `modelName: 'sonnet-3.7'` or other Anthropic models\n- **OpenRouter**: Set `modelName: 'openrouter/deepseek/deepseek-r1:free'` for Deepseek R1 or other models\n\nMake sure you have the appropriate API keys set in your environment variables:\n\n```bash\n# For OpenAI models\nexport OPENAI_API_KEY=\"your-openai-api-key\"\n\n# For Anthropic models\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key\"\n\n# For OpenRouter models\nexport OPENROUTER_API_KEY=\"your-openrouter-api-key\"\n```\n\n## Running Examples\n\nAll examples support TypeScript execution using `tsx`:\n\n```bash\n# Install tsx globally (optional)\nnpm install -g tsx\n\n# Or use npx\nnpx tsx example/starter.ts\n```\n\nFor production use, compile the TypeScript first:\n\n```bash\nnpm run build\nnode dist/example/starter.js\n```\n\n## Troubleshooting\n\n### Import Errors\n\nIf you get import errors, make sure you've built the SDK first:\n\n```bash\nnpm run build\n```\n\n### API Key Errors\n\nMake sure your API keys are set:\n\n```bash\n# Check if API key is set\necho $OPENAI_API_KEY\necho $ANTHROPIC_API_KEY\n\n# Set if missing\nexport OPENAI_API_KEY=\"your-key-here\"\n```\n\n### Playwright Browser Not Found\n\nInstall Playwright browsers:\n\n```bash\nnpx playwright install --force\n```\n\n## Additional Resources\n\n- [API Documentation](../docs/API_DOCS.md) - Complete API reference\n- [Task Guide](../docs/Task.md) - Understanding tasks and evaluations\n- [Agent Guide](../docs/manual_vs_basic_agent.md) - Building custom agents\n- [Main README](../README.md) - General SDK information\n"}, "caf9e0da5ccdd26910ca48fabd0511d82de81c00": {"t": 1785771547.3205817, "n": 8306, "h": "5be2cac1409c2f08", "c": "# AGI SDK Examples\n\nThis directory contains example implementations demonstrating how to use the AGI SDK for building and testing web agents in TypeScript/JavaScript. Each example showcases different approaches to agent implementation and configuration.\n\n## Available Examples\n\n### 1. `starter.ts`\n\nThe simplest agent implementation that works with any model. This is the best starting point for beginners.\n\n**Features:**\n- Minimal implementation using the built-in DemoAgent\n- Multiple configuration options for flexibility\n- Easy to understand and modify\n- Works with OpenAI, Anthropic, and OpenRouter models\n\n**How to run:**\n```bash\n# Install dependencies\nnpm install\n\n# Set your API key\nexport OPENAI_API_KEY=\"your-api-key\" # or ANTHROPIC_API_KEY\n\n# Run with default settings\nnpx tsx example/starter.ts\n\n# Run with custom model or configuration\nnpx tsx example/starter.ts --model gpt-4o --task v2.omnizon-1 --headless false\n```\n\n### 2. `custom.ts`\n\nBoilerplate code for creating your own custom agent. Use this as a template when implementing your own agent logic.\n\n**Features:**\n- Basic structure for a custom agent implementation\n- Minimal code needed to get started\n- Clear instructions for extending functionality\n- TypeScript interfaces for type safety\n\n**How to run:**\n```bash\n# Run the custom agent example\nnpx tsx example/custom.ts\n```\n\n### 3. `hackable.ts`\n\nA more advanced, feature-rich agent implementation designed for others to use and improve. This is our recommended agent for most use cases.\n\n**Features:**\n- Detailed agent implementation with observation preprocessing\n- Support for different model backends (OpenAI, Anthropic, OpenRouter)\n- Configurable agent parameters via command-line arguments\n- Extensive documentation and examples\n- Leaderboard submission support\n\n**How to run:**\n```bash\n# Run with default configuration\nnpx tsx example/hackable.ts\n\n# Run with custom parameters\nnpx tsx example/hackable.ts \\\n --model gpt-4o \\\n --task v2.omnizon-1 \\\n --headless false \\\n --use-html true \\\n --use-axtree true \\\n --use-screenshot true \\\n --leaderboard true \\\n --run-id your-run-id\n```\n\n### 4. `leaderboard.ts`\n\nExample demonstrating how to submit results to the REAL benchmark leaderboard.\n\n**Features:**\n- Leaderboard submission configuration\n- Environment variable support\n- Result tracking and display\n\n**How to run:**\n```bash\n# Set environment variables\nexport REAL_API_KEY=\"your-api-key\"\nexport REAL_RUN_ID=\"your-run-id\"\nexport REAL_MODEL_NAME=\"gpt-4o\"\nexport REAL_RUN_NAME=\"my-test-run\"\nexport OPENAI_API_KEY=\"your-openai-key\"\n\n# Run the example\nnpx tsx example/leaderboard.ts\n\n# Or pass via command-line\nnpx tsx example/leaderboard.ts \\\n --api-key \"your-api-key\" \\\n --run-id \"your-run-id\" \\\n --model-name \"gpt-4o\" \\\n --run-name \"my-test-run\"\n```\n\n### 5. `run_simple.ts`\n\nRun multiple tasks in sequence to benchmark agent performance across different scenarios.\n\n**Features:**\n- Batch task execution\n- Performance tracking and statistics\n- Configurable task list\n\n**How to run:**\n```bash\n# Set your API key\nexport OPENAI_API_KEY=\"your-key\"\n\n# Run with default settings\nnpx tsx example/run_simple.ts\n\n# Run with custom model\nnpx tsx example/run_simple.ts --model gpt-4o\n```\n\n## Submitting Examples to the REAL Leaderboard\n\n1. **Create an API key** inside the portal (Profile → API Keys).\n2. **Get a run ID**:\n - From the portal UI: Profile → Create Run, then copy the `run_id` from the runs table.\n - Or via the API:\n ```bash\n curl \"https://www.realevals.ai/api/runKey?api_key=<API_KEY>&model_name=<MODEL>&run_name=<RUN>\"\n ```\n The `newRunId` field in the response is your run identifier. You can override the base domain by setting `REAL_API_BASE=https://...` before running the SDK.\n3. **Set environment variables** so the examples submit automatically:\n ```bash\n export REAL_API_KEY=<API_KEY>\n export REAL_RUN_ID=<newRunId>\n export REAL_MODEL_NAME=<MODEL>\n export REAL_RUN_NAME=<RUN>\n ```\n Skip these variables if you want to run locally without submitting.\n4. Run the example (e.g., `npx tsx example/leaderboard.ts`). The harness uses those values, sets `RUNID`, and the clone will forward results to the leaderboard. Inside the SDK reference tasks as `v2.omnizon-1`; when querying portal APIs use the bare id (`omnizon-1`).\n\n## Harness Configuration\n\nMost examples use the REAL harness, which accepts various configuration parameters:\n\n```typescript\nimport { REAL } from '@theagicompany/agisdk';\n\nconst harness = new REAL.Harness({\n // Agent configuration\n agent: new REAL.DemoAgent({\n modelName: 'gpt-4o', // OpenAI models\n // or 'sonnet-3.7' // Anthropic models\n // or 'openrouter/deepseek/deepseek-r1:free' // OpenRouter models\n useAxtree: true,\n useScreenshot: true,\n useHtml: false,\n }),\n\n // Task selection (provide one of these)\n taskName: 'v2.omnizon-1', // Specific task to run\n // taskType: 'omnizon', // Run all tasks of this type\n // taskId: 1, // Run specific task ID within a type\n\n // Browser configuration\n headless: false, // Whether to show the browser\n maxSteps: 25, // Maximum number of steps\n\n // Observation options\n useHtml: false, // Include HTML in observations\n useAxtree: true, // Include accessibility tree\n useScreenshot: true, // Include screenshots\n\n // Leaderboard submission\n leaderboard: false, // Whether to submit to leaderboard\n runId: 'my_unique_id', // Unique ID for the submission\n apiKey: 'your-api-key', // API key for leaderboard\n\n // Execution options\n // numWorkers: 4, // Number of parallel workers (future)\n});\n\n// Run tasks\nconst results = await harness.run();\n```\n\n## Creating Your Own Agent\n\nTo create your own agent:\n\n1. Implement the `Agent` interface:\n ```typescript\n class MyAgent implements REAL.Agent {\n async getAction(obs: Observation): Promise<string> {\n // Your agent logic here\n return \"click('123')\";\n }\n\n async close(): Promise<void> {\n // Optional cleanup\n }\n }\n ```\n\n2. Use your agent with the harness:\n ```typescript\n const harness = new REAL.Harness({\n agent: new MyAgent(),\n taskName: 'v2.omnizon-1',\n headless: false,\n });\n\n const results = await harness.run();\n ```\n\nSee the `MyCustomAgent` class in `custom.ts` or the `DemoAgent` class in the SDK source for implementation examples.\n\n## Using Different Models\n\nThe AGI SDK supports various model providers through the `DemoAgent`:\n\n- **OpenAI**: Set `modelName: 'gpt-4o'` or other OpenAI models\n- **Anthropic**: Set `modelName: 'sonnet-3.7'` or other Anthropic models\n- **OpenRouter**: Set `modelName: 'openrouter/deepseek/deepseek-r1:free'` for Deepseek R1 or other models\n\nMake sure you have the appropriate API keys set in your environment variables:\n\n```bash\n# For OpenAI models\nexport OPENAI_API_KEY=\"your-openai-api-key\"\n\n# For Anthropic models\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key\"\n\n# For OpenRouter models\nexport OPENROUTER_API_KEY=\"your-openrouter-api-key\"\n```\n\n## Running Examples\n\nAll examples support TypeScript execution using `tsx`:\n\n```bash\n# Install tsx globally (optional)\nnpm install -g tsx\n\n# Or use npx\nnpx tsx example/starter.ts\n```\n\nFor production use, compile the TypeScript first:\n\n```bash\nnpm run build\nnode dist/example/starter.js\n```\n\n## Troubleshooting\n\n### Import Errors\n\nIf you get import errors, make sure you've built the SDK first:\n\n```bash\nnpm run build\n```\n\n### API Key Errors\n\nMake sure your API keys are set:\n\n```bash\n# Check if API key is set\necho $OPENAI_API_KEY\necho $ANTHROPIC_API_KEY\n\n# Set if missing\nexport OPENAI_API_KEY=\"your-key-here\"\n```\n\n### Playwright Browser Not Found\n\nInstall Playwright browsers:\n\n```bash\nnpx playwright install --force\n```\n\n## Additional Resources\n\n- [API Documentation](../docs/API_DOCS.md) - Complete API reference\n- [Task Guide](../docs/Task.md) - Understanding tasks and evaluations\n- [Agent Guide](../docs/manual_vs_basic_agent.md) - Building custom agents\n- [Main README](../README.md) - General SDK information\n"}, "0dca726f22f602aa469e74974a63f71cb0438978": {"t": 1785771549.107289, "n": 8300, "h": "b3b637bf508a89a5", "c": "# AGI SDK Examples\n\nThis directory contains example implementations demonstrating how to use the AGI SDK for building and testing web agents in TypeScript/JavaScript. Each example showcases different approaches to agent implementation and configuration.\n\n## Available Examples\n\n### 1. `starter.ts`\n\nThe simplest agent implementation that works with any model. This is the best starting point for beginners.\n\n**Features:**\n- Minimal implementation using the built-in DemoAgent\n- Multiple configuration options for flexibility\n- Easy to understand and modify\n- Works with OpenAI, Anthropic, and OpenRouter models\n\n**How to run:**\n```bash\n# Install dependencies\nnpm install\n\n# Set your API key\nexport OPENAI_API_KEY=\"your-api-key\" # or ANTHROPIC_API_KEY\n\n# Run with default settings\nnpx tsx example/starter.ts\n\n# Run with custom model or configuration\nnpx tsx example/starter.ts --model gpt-4o --task v2.omnizon-1 --headless false\n```\n\n### 2. `custom.ts`\n\nBoilerplate code for creating your own custom agent. Use this as a template when implementing your own agent logic.\n\n**Features:**\n- Basic structure for a custom agent implementation\n- Minimal code needed to get started\n- Clear instructions for extending functionality\n- TypeScript interfaces for type safety\n\n**How to run:**\n```bash\n# Run the custom agent example\nnpx tsx example/custom.ts\n```\n\n### 3. `hackable.ts`\n\nA more advanced, feature-rich agent implementation designed for others to use and improve. This is our recommended agent for most use cases.\n\n**Features:**\n- Detailed agent implementation with observation preprocessing\n- Support for different model backends (OpenAI, Anthropic, OpenRouter)\n- Configurable agent parameters via command-line arguments\n- Extensive documentation and examples\n- Leaderboard submission support\n\n**How to run:**\n```bash\n# Run with default configuration\nnpx tsx example/hackable.ts\n\n# Run with custom parameters\nnpx tsx example/hackable.ts \\\n --model gpt-4o \\\n --task v2.omnizon-1 \\\n --headless false \\\n --use-html true \\\n --use-axtree true \\\n --use-screenshot true \\\n --leaderboard true \\\n --run-id your-run-id\n```\n\n### 4. `leaderboard.ts`\n\nExample demonstrating how to submit results to the REAL benchmark leaderboard.\n\n**Features:**\n- Leaderboard submission configuration\n- Environment variable support\n- Result tracking and display\n\n**How to run:**\n```bash\n# Set environment variables\nexport REAL_API_KEY=\"your-api-key\"\nexport REAL_RUN_ID=\"your-run-id\"\nexport REAL_MODEL_NAME=\"gpt-4o\"\nexport REAL_RUN_NAME=\"my-test-run\"\nexport OPENAI_API_KEY=\"your-openai-key\"\n\n# Run the example\nnpx tsx example/leaderboard.ts\n\n# Or pass via command-line\nnpx tsx example/leaderboard.ts \\\n --api-key \"your-api-key\" \\\n --run-id \"your-run-id\" \\\n --model-name \"gpt-4o\" \\\n --run-name \"my-test-run\"\n```\n\n### 5. `run_simple.ts`\n\nRun multiple tasks in sequence to benchmark agent performance across different scenarios.\n\n**Features:**\n- Batch task execution\n- Performance tracking and statistics\n- Configurable task list\n\n**How to run:**\n```bash\n# Set your API key\nexport OPENAI_API_KEY=\"your-key\"\n\n# Run with default settings\nnpx tsx example/run_simple.ts\n\n# Run with custom model\nnpx tsx example/run_simple.ts --model gpt-4o\n```\n\n## Submitting Examples to the REAL Leaderboard\n\n1. **Create an API key** inside the portal (Profile → API Keys).\n2. **Get a run ID**:\n - From the portal UI: Profile → Create Run, then copy the `run_id` from the runs table.\n - Or via the API:\n ```bash\n curl \"https://www.realevals.ai/api/runKey?api_key=<API_KEY>&model_name=<MODEL>&run_name=<RUN>\"\n ```\n The `newRunId` field in the response is your run identifier. You can override the base domain by setting `REAL_API_BASE=https://...` before running the SDK.\n3. **Set environment variables** so the examples submit automatically:\n ```bash\n export REAL_API_KEY=<API_KEY>\n export REAL_RUN_ID=<newRunId>\n export REAL_MODEL_NAME=<MODEL>\n export REAL_RUN_NAME=<RUN>\n ```\n Skip these variables if you want to run locally without submitting.\n4. Run the example (e.g., `npx tsx example/leaderboard.ts`). The harness uses those values, sets `RUNID`, and the clone will forward results to the leaderboard. Inside the SDK reference tasks as `v2.omnizon-1`; when querying portal APIs use the bare id (`omnizon-1`).\n\n## Harness Configuration\n\nMost examples use the REAL harness, which accepts various configuration parameters:\n\n```typescript\nimport { REAL } from '@agi-inc/agisdk';\n\nconst harness = new REAL.Harness({\n // Agent configuration\n agent: new REAL.DemoAgent({\n modelName: 'gpt-4o', // OpenAI models\n // or 'sonnet-3.7' // Anthropic models\n // or 'openrouter/deepseek/deepseek-r1:free' // OpenRouter models\n useAxtree: true,\n useScreenshot: true,\n useHtml: false,\n }),\n\n // Task selection (provide one of these)\n taskName: 'v2.omnizon-1', // Specific task to run\n // taskType: 'omnizon', // Run all tasks of this type\n // taskId: 1, // Run specific task ID within a type\n\n // Browser configuration\n headless: false, // Whether to show the browser\n maxSteps: 25, // Maximum number of steps\n\n // Observation options\n useHtml: false, // Include HTML in observations\n useAxtree: true, // Include accessibility tree\n useScreenshot: true, // Include screenshots\n\n // Leaderboard submission\n leaderboard: false, // Whether to submit to leaderboard\n runId: 'my_unique_id', // Unique ID for the submission\n apiKey: 'your-api-key', // API key for leaderboard\n\n // Execution options\n // numWorkers: 4, // Number of parallel workers (future)\n});\n\n// Run tasks\nconst results = await harness.run();\n```\n\n## Creating Your Own Agent\n\nTo create your own agent:\n\n1. Implement the `Agent` interface:\n ```typescript\n class MyAgent implements REAL.Agent {\n async getAction(obs: Observation): Promise<string> {\n // Your agent logic here\n return \"click('123')\";\n }\n\n async close(): Promise<void> {\n // Optional cleanup\n }\n }\n ```\n\n2. Use your agent with the harness:\n ```typescript\n const harness = new REAL.Harness({\n agent: new MyAgent(),\n taskName: 'v2.omnizon-1',\n headless: false,\n });\n\n const results = await harness.run();\n ```\n\nSee the `MyCustomAgent` class in `custom.ts` or the `DemoAgent` class in the SDK source for implementation examples.\n\n## Using Different Models\n\nThe AGI SDK supports various model providers through the `DemoAgent`:\n\n- **OpenAI**: Set `modelName: 'gpt-4o'` or other OpenAI models\n- **Anthropic**: Set `modelName: 'sonnet-3.7'` or other Anthropic models\n- **OpenRouter**: Set `modelName: 'openrouter/deepseek/deepseek-r1:free'` for Deepseek R1 or other models\n\nMake sure you have the appropriate API keys set in your environment variables:\n\n```bash\n# For OpenAI models\nexport OPENAI_API_KEY=\"your-openai-api-key\"\n\n# For Anthropic models\nexport ANTHROPIC_API_KEY=\"your-anthropic-api-key\"\n\n# For OpenRouter models\nexport OPENROUTER_API_KEY=\"your-openrouter-api-key\"\n```\n\n## Running Examples\n\nAll examples support TypeScript execution using `tsx`:\n\n```bash\n# Install tsx globally (optional)\nnpm install -g tsx\n\n# Or use npx\nnpx tsx example/starter.ts\n```\n\nFor production use, compile the TypeScript first:\n\n```bash\nnpm run build\nnode dist/example/starter.js\n```\n\n## Troubleshooting\n\n### Import Errors\n\nIf you get import errors, make sure you've built the SDK first:\n\n```bash\nnpm run build\n```\n\n### API Key Errors\n\nMake sure your API keys are set:\n\n```bash\n# Check if API key is set\necho $OPENAI_API_KEY\necho $ANTHROPIC_API_KEY\n\n# Set if missing\nexport OPENAI_API_KEY=\"your-key-here\"\n```\n\n### Playwright Browser Not Found\n\nInstall Playwright browsers:\n\n```bash\nnpx playwright install --force\n```\n\n## Additional Resources\n\n- [API Documentation](../docs/API_DOCS.md) - Complete API reference\n- [Task Guide](../docs/Task.md) - Understanding tasks and evaluations\n- [Agent Guide](../docs/manual_vs_basic_agent.md) - Building custom agents\n- [Main README](../README.md) - General SDK information\n"}, "3761ec730dfb201305c6aaea7c57623e6e3890e3": {"t": 1785771553.6171215, "n": 3990, "h": "29d371fd6910b815", "c": "# AGI SDK Examples\n\nThis directory contains example implementations demonstrating how to use the AGI SDK for building and testing web agents. Each example showcases different approaches to agent implementation and configuration.\n\n## Available Examples\n\n### 1. `starter.ts`\n\nThe simplest agent implementation that demonstrates basic usage. This is the best starting point for beginners.\n\n**Features:**\n- Minimal implementation\n- Easy to understand and modify\n- Shows basic agent interface\n\n**How to run:**\n```bash\n# Run with ts-node\nnpx ts-node example/starter.ts\n\n# Or compile and run\nnpm run build\nnode dist/example/starter.js\n```\n\n### 2. `custom.ts`\n\nBoilerplate code for creating your own custom agent. Use this as a template when implementing your own agent logic.\n\n**Features:**\n- Basic structure for a custom agent implementation\n- Minimal code needed to get started\n- Clear instructions for extending functionality\n\n**How to run:**\n```bash\nnpx ts-node example/custom.ts\n```\n\n### 3. `simple.ts`\n\nA simple example running multiple tasks sequentially.\n\n**Features:**\n- Runs multiple tasks in sequence\n- Shows how to iterate over tasks\n- Displays results for each task\n\n**How to run:**\n```bash\nnpx ts-node example/simple.ts\n```\n\n### 4. `leaderboard.ts`\n\nExample showing how to submit results to the REAL leaderboard.\n\n**Features:**\n- Leaderboard submission configuration\n- API key and run ID management\n- Result submission\n\n**How to run:**\n```bash\n# Set environment variables first\nexport REAL_API_KEY=\"your-api-key\"\nexport REAL_RUN_ID=\"your-run-id\"\n\nnpx ts-node example/leaderboard.ts\n```\n\n## Harness Configuration\n\nThe harness accepts various configuration parameters:\n\n```typescript\nconst harness = new REAL.Harness(\n agent, // Your agent instance\n headless: false, // Whether to show the browser\n taskDir?: string, // Optional: custom task directory\n resultsDir: \"./results\" // Where to save results\n);\n\n// Run a specific task\nawait harness.run(\"omnizon-3\");\n\n// Run multiple tasks\nawait harness.run([\"omnizon-3\", \"dashdish-1\"]);\n```\n\n## Creating Your Own Agent\n\nTo create your own agent:\n\n1. Implement the `REAL.Agent` interface:\n ```typescript\n class MyAgent implements REAL.Agent {\n async getAction(obs: REAL.Obs): Promise<string> {\n // Process observation and return action string\n return \"click('123')\";\n }\n }\n ```\n\n2. Use your agent with the harness:\n ```typescript\n const agent = new MyAgent();\n const harness = new REAL.Harness(agent, false);\n await harness.run(\"omnizon-3\");\n ```\n\nSee `custom.ts` for a complete implementation example.\n\n## Supported Actions\n\n- `click(bid)` - Click element by BID\n- `fill(bid, text)` - Fill input by BID\n- `goto(url)` - Navigate to URL\n- `go_back()` - Browser back\n- `go_forward()` - Browser forward\n- `press(bid, key)` or `press(key)` - Press key\n- `scroll(x, y)` - Scroll page\n- `send_msg_to_user(text)` - Send message to chat\n- `report_infeasible(reason)` - Report task as infeasible\n\n## Observation Structure\n\nYour agent receives observations with the following structure:\n\n```typescript\ninterface Obs {\n chat_messages: any[];\n goal: string;\n goal_object: any[];\n open_pages_urls: string[];\n active_page_index: number;\n url: string;\n screenshot: Buffer;\n dom_object: any; // CDP DOMSnapshot\n axtree_object: any; // CDP AXTree\n focused_element_bid: string;\n last_action: string;\n last_action_error: string;\n elapsed_time: number;\n browser: Browser;\n}\n```\n\n## Task Directory\n\nBy default, the SDK looks for tasks in:\n```\n../../agisdk/src/agisdk/REAL/browsergym/webclones/v2/tasks\n```\n\nYou can override this by passing a `taskDir` parameter to the harness constructor.\n\n## Results\n\nResults are saved in the `results/` directory (or your specified `resultsDir`):\n- Screenshots: `screenshot_step_N.png`\n- Step info: `step_N.json`\n\nEach task run creates a unique directory named `{taskId}_{runId}/`.\n\n"}}}}