### Install Apify CLI Source: https://github.com/apify/agent-skills/blob/main/README.md Install the Apify CLI globally using npm or Homebrew. This is the recommended setup for local Actor development and authentication. ```bash npm install -g apify-cli ``` ```bash brew install apify-cli ``` -------------------------------- ### Install Apify SDK Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/references/python-actorization.md Install the Apify SDK using pip. ```bash pip install apify ``` -------------------------------- ### Install Apify SDK Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/references/js-ts-actorization.md Install the Apify SDK using npm. This is the first step to using Apify Actorization. ```bash npm install apify ``` -------------------------------- ### Install apify-client for Python Source: https://github.com/apify/agent-skills/blob/main/skills/apify-sdk-integration/SKILL.md Install the Apify client library for Python applications using pip. ```bash pip install apify-client ``` -------------------------------- ### Install apify-client for Node.js Source: https://github.com/apify/agent-skills/blob/main/skills/apify-sdk-integration/SKILL.md Install the Apify client library for JavaScript/TypeScript applications using npm. ```bash npm install apify-client ``` -------------------------------- ### Install Apify CLI (Homebrew) Source: https://github.com/apify/agent-skills/blob/main/commands/create-actor.md Install the Apify CLI on macOS using Homebrew. This is an alternative to npm installation. ```bash brew install apify-cli ``` -------------------------------- ### Install Apify CLI (npm) Source: https://github.com/apify/agent-skills/blob/main/commands/create-actor.md Install the Apify CLI using npm if it's not already installed. Avoid piping remote scripts directly to a shell for security reasons. ```bash npm install -g apify-cli ``` -------------------------------- ### Dockerfile for CLI-based Actor Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/references/cli-actorization.md This Dockerfile sets up an environment for a CLI-based actor. It installs necessary tools like `ubi`, `apify-cli`, and `jq`, copies the application code, and makes the start script executable. ```dockerfile FROM apify/actor-node:20 # Install ubi for easy GitHub release installation RUN curl --silent --location \ https://raw.githubusercontent.com/houseabsolute/ubi/master/bootstrap/bootstrap-ubi.sh | sh # Install your CLI tool from GitHub releases (example) # RUN ubi --project your-org/your-tool --in /usr/local/bin # Or install apify-cli and jq manually RUN npm install -g apify-cli RUN apt-get update && apt-get install -y jq # Copy your application COPY . . # Build your application if needed # RUN ./build.sh # Make start script executable RUN chmod +x start.sh # Run the wrapper script CMD ["./start.sh"] ``` -------------------------------- ### Adapt Crawlee Projects for Apify Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/references/js-ts-actorization.md Integrate Crawlee projects with the Apify Actor lifecycle. This example includes input validation and basic crawler setup. ```javascript import { Actor } from 'apify'; import { PlaywrightCrawler } from 'crawlee'; await Actor.init(); // Get and validate input const input = await Actor.getInput(); const { startUrl = 'https://example.com', maxItems = 100, } = input ?? {}; let itemCount = 0; const crawler = new PlaywrightCrawler({ requestHandler: async ({ page, request, pushData }) => { if (itemCount >= maxItems) return; const title = await page.title(); await pushData({ url: request.url, title }); itemCount++; }, }); await crawler.run([startUrl]); await Actor.exit(); ``` -------------------------------- ### JavaScript/TypeScript Express Example for Standby Mode Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/references/standby-mode.md This example demonstrates how to set up an Express.js server for an Apify Actor running in Standby mode. It includes a readiness probe and an example '/search' endpoint. Ensure you import necessary Apify SDK modules and use the SDK-provided port. ```javascript import { Actor, log } from 'apify'; import express from 'express'; await Actor.init(); const app = express(); app.use(express.json()); const port = Actor.config.get('containerPort'); // Readiness probe app.get('/', (req, res) => { if (req.headers['x-apify-container-server-readiness-probe']) { return res.send('OK'); } res.json({ status: 'Actor is running in Standby mode' }); }); // Example endpoint app.get('/search', (req, res) => { const { query } = req.query; log.info('Handling search request', { query }); // ... handle request ... res.json({ results: [] }); }); app.listen(port, () => log.info(`Listening on port ${port}`)); ``` -------------------------------- ### Multiple Files Output Schema Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-generate-output-schema/SKILL.md Example of a key-value store schema for multiple files with prefixes, such as screenshots or documents. It defines collections with key prefixes and content types. ```json { "actorKeyValueStoreSchemaVersion": 1, "title": "Scraped Files", "description": "Key-value store containing downloaded files and screenshots", "collections": { "screenshots": { "title": "Screenshots", "description": "Page screenshots captured during scraping", "keyPrefix": "screenshot-", "contentTypes": ["image/png", "image/jpeg"] }, "documents": { "title": "Documents", "description": "Downloaded document files", "keyPrefix": "doc-", "contentTypes": ["application/pdf", "text/html"] } } } ``` -------------------------------- ### Check Apify CLI Installation Source: https://github.com/apify/agent-skills/blob/main/commands/create-actor.md Verify if the Apify CLI is installed on your system. This is a crucial first step before proceeding with Actor development. ```bash apify --help ``` -------------------------------- ### Start a Run Source: https://github.com/apify/agent-skills/blob/main/skills/apify-sdk-integration/SKILL.md Initiates a new run for a specified actor. You can provide starting URLs and other configurations in the request body. ```APIDOC ## POST /v2/acts/{actorId}/runs ### Description Starts a new run for a specified actor. ### Method POST ### Endpoint https://api.apify.com/v2/acts/{actorId}/runs ### Parameters #### Request Body - **startUrls** (array) - Required - A list of URLs to start the actor run with. - **url** (string) - Required - The URL to process. ### Request Example { "startUrls": [ { "url": "https://example.com" } ] } ### Response #### Success Response (200) - **status** (string) - The status of the run. - **runId** (string) - The ID of the created run. - **actorId** (string) - The ID of the actor. - **createdAt** (string) - The timestamp when the run was created. ``` -------------------------------- ### Single File Output Schema Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-generate-output-schema/SKILL.md Example of a key-value store schema for a single file output, like a report. It uses a fixed key and specifies content types. ```json { "actorKeyValueStoreSchemaVersion": 1, "title": "Analysis Results", "description": "Key-value store containing analysis output", "collections": { "report": { "title": "Report", "description": "Final analysis report", "key": "REPORT", "contentTypes": ["application/json"] } } } ``` -------------------------------- ### Wrap Main Code with Actor Lifecycle Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/references/js-ts-actorization.md Initialize and exit the Apify Actor lifecycle around your existing JavaScript code. This example shows how to get input and push data. ```javascript import { Actor } from 'apify'; // Initialize connection to Apify platform await Actor.init(); // ============================================ // Your existing code goes here // ============================================ // Example: Get input from Apify Console or API const input = await Actor.getInput(); console.log('Input:', input); // Example: Your crawler or processing logic // const crawler = new PlaywrightCrawler({ ... }); // await crawler.run([input.startUrl]); // Example: Push results to dataset // await Actor.pushData({ result: 'data' }); // ============================================ // End of your code // ============================================ // Graceful shutdown await Actor.exit(); ``` -------------------------------- ### Python FastAPI Example for Standby Mode Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/references/standby-mode.md This example shows a FastAPI application for an Apify Actor in Standby mode. It implements the readiness probe at '/' and an example '/search' endpoint. The server listens on the port provided by the Apify SDK. ```python from apify import Actor import uvicorn from fastapi import FastAPI, Request app = FastAPI() @app.get('/') async def root(request: Request): if 'x-apify-container-server-readiness-probe' in request.headers: return {'status': 'OK'} return {'status': 'Actor is running in Standby mode'} @app.get('/search') async def search(query: str): Actor.log.info('Handling search request', extra={'query': query}) # ... handle request ... return {'results': []} async def main(): async with Actor: port = Actor.config.container_port server = uvicorn.Server(uvicorn.Config(app, host='0.0.0.0', port=port)) await server.serve() if __name__ == '__main__': import asyncio asyncio.run(main()) ``` -------------------------------- ### Crawlee Python Project Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/references/python-actorization.md An example of an actorized Python project using Crawlee for web scraping. It demonstrates getting input, setting up a request handler, and running a PlaywrightCrawler. ```python import asyncio from apify import Actor from crawlee.playwright_crawler import PlaywrightCrawler async def main() -> None: async with Actor: # Get and validate input actor_input = await Actor.get_input() or {} start_url = actor_input.get('startUrl', 'https://example.com') max_items = actor_input.get('maxItems', 100) item_count = 0 async def request_handler(context): nonlocal item_count if item_count >= max_items: return title = await context.page.title() await context.push_data({'url': context.request.url, 'title': title}) item_count += 1 crawler = PlaywrightCrawler(request_handler=request_handler) await crawler.run([start_url]) if __name__ == '__main__': asyncio.run(main()) ``` -------------------------------- ### Example Actor JSON Configuration Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/references/actor-json.md An example of a completed actor.json file for a JavaScript Cheerio crawler project. Note the specific values for name, title, and meta.generatedBy. ```json { "actorSpecification": 1, "name": "project-cheerio-crawler-javascript", "title": "Project Cheerio Crawler JavaScript", "description": "Crawlee and Cheerio project in JavaScript.", "version": "0.0", "meta": { "templateId": "js-crawlee-cheerio", "generatedBy": "Claude Code with Claude Sonnet 4.5" }, "input": "./input_schema.json", "output": "./output_schema.json", "storages": { "dataset": "./dataset_schema.json" }, "dockerfile": "../Dockerfile" } ``` -------------------------------- ### Batch Processing Script Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/references/python-actorization.md An example of an actorized Python script for batch processing. It shows how to retrieve input items and push processed results using `Actor.push_data`. ```python import asyncio from apify import Actor async def main() -> None: async with Actor: actor_input = await Actor.get_input() or {} items = actor_input.get('items', []) for item in items: result = process_item(item) await Actor.push_data(result) if __name__ == '__main__': asyncio.run(main()) ``` -------------------------------- ### Install Apify Agent Skills with Claude Code Source: https://github.com/apify/agent-skills/blob/main/README.md Use these commands to install the Apify Agent Skills plugin and related tools using Claude Code. ```bash /plugin marketplace add https://github.com/apify/agent-skills /plugin install apify-ultimate-scraper@apify-agent-skills /plugin install apify-actor-development@apify-agent-skills /plugin install apify-actorization@apify-agent-skills /plugin install apify-generate-output-schema@apify-agent-skills /plugin install apify-sdk-integration@apify-agent-skills ``` -------------------------------- ### Testing Standby Mode Readiness Probe Locally Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/references/standby-mode.md Use `curl` to test the readiness probe endpoint (`GET /`) locally. Pass the `x-apify-container-server-readiness-probe` header to simulate the platform's check. Replace `` with your server's running port. ```bash curl -H "x-apify-container-server-readiness-probe: true" http://localhost:/ ``` -------------------------------- ### Example Actor Output Schema Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/references/output-schema.md An example of a file scraper's output schema, demonstrating how to define 'files' and 'dataset' outputs with templates. ```json { "actorOutputSchemaVersion": 1, "title": "Output schema of the files scraper", "properties": { "files": { "type": "string", "title": "Files", "template": "{{links.apiDefaultKeyValueStoreUrl}}/keys" }, "dataset": { "type": "string", "title": "Dataset", "template": "{{links.apiDefaultDatasetUrl}}/items" } } } ``` -------------------------------- ### Start an Actor Run Source: https://github.com/apify/agent-skills/blob/main/skills/apify-sdk-integration/SKILL.md Use this snippet to initiate a new run for an Actor. Ensure you replace `{actorId}` with the actual Actor ID and provide the necessary API token and input schema. ```bash POST https://api.apify.com/v2/acts/{actorId}/runs Authorization: Bearer Content-Type: application/json { "startUrls": [{ "url": "https://example.com" }] } ``` -------------------------------- ### Install Python Actor Dependencies Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/SKILL.md Install project dependencies for Python Actors using pip. Ensure exact versions are pinned in requirements.txt for reproducible builds. ```bash pip install -r requirements.txt ``` -------------------------------- ### String Field Schema Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-generate-output-schema/SKILL.md Defines a string field with a description, nullable property, and an example value. Use for text-based data. ```json { "title": { "type": "string", "description": "Title of the scraped item", "nullable": true, "example": "Example Item Title" } } ``` -------------------------------- ### Create a new Apify Actor (JavaScript) Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/SKILL.md Use this command to create a new Apify Actor project using an empty JavaScript template. This is the starting point for JavaScript-based Actors. ```bash apify create -t project_empty ``` -------------------------------- ### Create a new Apify Actor (Python) Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/SKILL.md Use this command to create a new Apify Actor project using an empty Python template. This is the starting point for Python-based Actors. ```bash apify create -t python-empty ``` -------------------------------- ### JavaScript/TypeScript Actor Initialization and Exit Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/SKILL.md Demonstrates the basic lifecycle methods for JavaScript/TypeScript Actors using the Apify SDK. Ensure 'apify' is installed via npm. ```javascript await Actor.init() // ... your actor code ... await Actor.exit() ``` -------------------------------- ### Start Apify Actor (Long-Running) Source: https://github.com/apify/agent-skills/blob/main/skills/apify-ultimate-scraper/SKILL.md Initiate an Actor run that may take a long time to complete. This command starts the run asynchronously, returning a run ID for later polling. ```bash apify actors start "ACTOR_ID" -i 'JSON_INPUT' --user-agent apify-agent-skills/apify-ultimate-scraper --json 2>/dev/null ``` -------------------------------- ### Install Playwright MCP via Claude Code CLI Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/SKILL.md Use this command to quickly add the Playwright MCP server to your project using the Claude Code CLI. ```bash claude mcp add playwright npx @playwright/mcp@latest ``` -------------------------------- ### Create a new Apify Actor (TypeScript) Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/SKILL.md Use this command to create a new Apify Actor project using an empty TypeScript template. This is the starting point for TypeScript-based Actors. ```bash apify create -t ts_empty ``` -------------------------------- ### Actor Input Schema Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/references/schemas-and-output.md Defines the structure and validation rules for an Actor's input. Use this to map application inputs to actor parameters. ```json { "title": "My Actor Input", "type": "object", "schemaVersion": 1, "properties": { "startUrl": { "title": "Start URL", "type": "string", "description": "The URL to start processing from", "editor": "textfield", "prefill": "https://example.com" }, "maxItems": { "title": "Max Items", "type": "integer", "description": "Maximum number of items to process", "default": 100, "minimum": 1 } }, "required": ["startUrl"] } ``` -------------------------------- ### Example E-commerce Product Scraper Input Schema Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/references/input-schema.md An example of a detailed input schema for an e-commerce product scraper. It includes various field types like arrays, booleans, integers, objects, and strings, with specific editors and validation rules. ```json { "title": "E-commerce Product Scraper Input", "type": "object", "schemaVersion": 1, "properties": { "startUrls": { "title": "Start URLs", "type": "array", "description": "URLs to start scraping from (category pages or product pages)", "editor": "requestListSources", "default": [{ "url": "https://example.com/category" }], "prefill": [{ "url": "https://example.com/category" }] }, "followVariants": { "title": "Follow Product Variants", "type": "boolean", "description": "Whether to scrape product variants (different colors, sizes)", "default": true }, "maxRequestsPerCrawl": { "title": "Max Requests per Crawl", "type": "integer", "description": "Maximum number of pages to scrape (0 = unlimited)", "default": 1000, "minimum": 0 }, "proxyConfiguration": { "title": "Proxy Configuration", "type": "object", "description": "Proxy settings for anti-bot protection", "editor": "proxy", "default": { "useApifyProxy": false } }, "locale": { "title": "Locale", "type": "string", "description": "Language/country code for localized content", "default": "cs", "enum": ["cs", "en", "de", "sk"], "enumTitles": ["Czech", "English", "German", "Slovak"] } }, "required": ["startUrls"] } ``` -------------------------------- ### Get Actor Pricing Information Source: https://github.com/apify/agent-skills/blob/main/skills/apify-ultimate-scraper/references/gotchas.md Use this command to retrieve an Actor's pricing details, including its pricing model and price per event. This is crucial for cost estimation before running PAY_PER_EVENT Actors. ```bash apify actors info "ACTOR_ID" --user-agent apify-agent-skills/apify-ultimate-scraper --json ``` -------------------------------- ### Charge for an Event (JavaScript) Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/SKILL.md Implement monetization by charging for specific events within your Actor's code using the Apify SDK. This example shows how to charge for a 'result' event. ```javascript await Actor.charge('result') ``` -------------------------------- ### Start an Actor and Poll for Status Source: https://github.com/apify/agent-skills/blob/main/skills/apify-ultimate-scraper/references/gotchas.md Initiate an Actor run in 'fire-and-forget' mode and subsequently poll its status. This is useful for long-running tasks where immediate feedback is not required. ```bash apify actors start --user-agent apify-agent-skills/apify-ultimate-scraper --json ``` ```bash apify runs info RUN_ID --user-agent apify-agent-skills/apify-ultimate-scraper --json ``` -------------------------------- ### Bootstrap and Local Development Commands Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/SKILL.md Commands for creating, initializing, running, and validating Apify Actor projects locally. These commands help set up the development environment and test Actors before deployment. ```bash apify create [name] # Create new Actor project from a template apify init # Initialize Actor in current directory apify run # Run Actor locally with simulated platform env apify run --purge # Run after clearing previous local storage apify validate-schema # Validate .actor/input_schema.json ``` -------------------------------- ### Initialize Actor Structure Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/SKILL.md Initializes a new Actor project structure in the current directory. This command creates essential configuration files like .actor/actor.json, .actor/input_schema.json, and potentially a Dockerfile. ```bash apify init ``` -------------------------------- ### Check Actor README for Dependencies Source: https://github.com/apify/agent-skills/blob/main/skills/apify-ultimate-scraper/references/gotchas.md When encountering authentication errors or unexpected empty results, consult the Actor's README file. This command helps identify requirements like cookies or login sessions. ```bash apify actors info "ACTOR_ID" --user-agent apify-agent-skills/apify-ultimate-scraper --readme ``` -------------------------------- ### Boolean Field Schema Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-generate-output-schema/SKILL.md Defines a boolean field with a description, nullable property, and an example boolean value. Use for true/false states. ```json { "isVerified": { "type": "boolean", "description": "Whether the account is verified", "nullable": true, "example": true } } ``` -------------------------------- ### Number Field Schema Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-generate-output-schema/SKILL.md Defines a number field with a description, nullable property, and an example numeric value. Use for quantitative data. ```json { "viewCount": { "type": "number", "description": "Number of views", "nullable": true, "example": 15000 } } ``` -------------------------------- ### Apify CLI: Deployment and Execution Commands Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/SKILL.md Commands for deploying, downloading, and executing Actors on the Apify platform. Use these for managing your Actor's lifecycle and remote execution. ```bash apify push # Deploy Actor to platform per .actor/actor.json apify pull # Download Actor code from the platform apify call # Execute Actor remotely on the platform apify actors build # Create a new build of an Actor apify runs ls # List recent runs ``` -------------------------------- ### Save Records to Key-Value Store (Python) Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/references/key-value-store-schema.md Shows how to save text and image data to the key-value store using `Actor.set_value()`. Requires `Actor.init()` and is typically run within an `async` function. ```python # Key-Value Store set example (Python) import asyncio from apify import Actor async def main(): await Actor.init() # Actor code await Actor.set_value('document-1', 'my text data', content_type='text/plain') image_id = '123' # example placeholder image_buffer = b'...' # bytes buffer with image data await Actor.set_value(f'image-{image_id}', image_buffer, content_type='image/jpeg') # Exit successfully await Actor.exit() if __name__ == '__main__': asyncio.run(main()) ``` -------------------------------- ### Install JavaScript/TypeScript Actor Dependencies Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/SKILL.md Install project dependencies for JavaScript or TypeScript Actors using npm. It's recommended to commit the package-lock.json for reproducible builds. ```bash npm install ``` -------------------------------- ### Local Input Data Configuration Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/SKILL.md Configure input data for local Actor testing by creating a JSON file in the specified path. This mirrors how input is provided on the Apify platform. ```bash storage/key_value_stores/default/INPUT.json ``` -------------------------------- ### Array Field Schema Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-generate-output-schema/SKILL.md Defines an array field, specifying the type of its items, along with a description, nullable property, and an example array. Use for lists of values. ```json { "hashtags": { "type": "array", "description": "Hashtags associated with the item", "items": { "type": "string" }, "nullable": true, "example": ["#example", "#demo"] } } ``` -------------------------------- ### Apify CLI: Direct API Access and Help Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/SKILL.md Commands for making authenticated HTTP requests to the Apify API and accessing help documentation for commands. Essential for advanced interaction and troubleshooting. ```bash apify api # Authenticated HTTP request to Apify API apify help # List all commands apify --help # Detailed help for a specific command ``` -------------------------------- ### Bash Wrapper Script for CLI Actor Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/references/cli-actorization.md This script fetches input from the Apify key-value store, parses it using jq, and runs a local application with the provided parameters. It also shows how to push output to the key-value store or dataset. ```bash #!/bin/bash set -e # Get input from Apify key-value store INPUT=$(apify actor:get-input) # Parse input values (adjust based on your input schema) MY_PARAM=$(echo "$INPUT" | jq -r '.myParam // "default"') # Run your application with the input ./your-application --param "$MY_PARAM" # If your app writes to a file, push it to key-value store # apify actor:set-value OUTPUT --contentType application/json < output.json # Or push structured data to dataset # apify actor:push-data '{"result": "value"}' ``` -------------------------------- ### Enum Field Schema Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-generate-output-schema/SKILL.md Defines an enum field (string type) with a list of allowed values, a description, nullable property, and an example value. Use for fields with a fixed set of options. ```json { "contentType": { "type": "string", "description": "Type of content", "enum": ["article", "video", "image"], "nullable": true, "example": "article" } } ``` -------------------------------- ### Nested Object Field Schema Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-generate-output-schema/SKILL.md Defines a nested object field with its own properties, required fields, additional properties rule, nullable property, and an example object. Use for structured sub-data. ```json { "authorInfo": { "type": "object", "description": "Information about the author", "properties": { "name": { "type": "string", "nullable": true }, "url": { "type": "string", "nullable": true } }, "required": [], "additionalProperties": true, "nullable": true, "example": { "name": "Example Author", "url": "https://example.com/author" } } } ``` -------------------------------- ### Union Type Field Schema Example Source: https://github.com/apify/agent-skills/blob/main/skills/apify-generate-output-schema/SKILL.md Defines a field that can be one of multiple types (e.g., object or string), including a description, nullable property, and an example value. Use for flexible data types. ```json { "metadata": { "type": ["object", "string"], "description": "Structured metadata object, or error string if unavailable", "nullable": true, "example": { "key": "value" } } } ``` -------------------------------- ### Save Records to Key-Value Store (JavaScript) Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actor-development/references/key-value-store-schema.md Demonstrates saving text and image data to the key-value store using `Actor.setValue()`. Ensure `Actor.init()` is called before use. ```javascript import { Actor } from 'apify'; // Initialize the JavaScript SDK await Actor.init(); /** * Actor code */ await Actor.setValue('document-1', 'my text data', { contentType: 'text/plain' }); await Actor.setValue(`image-${imageID}`, imageBuffer, { contentType: 'image/jpeg' }); // Exit successfully await Actor.exit(); ``` -------------------------------- ### Get Run Status Source: https://github.com/apify/agent-skills/blob/main/skills/apify-sdk-integration/SKILL.md Retrieves the current status of a specific actor run using its ID. ```APIDOC ## GET /v2/acts/{actorId}/runs/{runId} ### Description Retrieves the status of a specific actor run. ### Method GET ### Endpoint https://api.apify.com/v2/acts/{actorId}/runs/{runId} ### Response #### Success Response (200) - **status** (string) - The current status of the run (e.g., SUCCEEDED, RUNNING, FAILED). - **runId** (string) - The ID of the run. - **actorId** (string) - The ID of the actor. - **createdAt** (string) - The timestamp when the run was created. - **finishedAt** (string) - The timestamp when the run finished (if applicable). ``` -------------------------------- ### Get Dataset Items Source: https://github.com/apify/agent-skills/blob/main/skills/apify-sdk-integration/SKILL.md Fetches items from a dataset associated with an actor run. Supports pagination and format selection. ```APIDOC ## GET /v2/datasets/{datasetId}/items ### Description Retrieves items from a dataset. ### Method GET ### Endpoint https://api.apify.com/v2/datasets/{datasetId}/items ### Parameters #### Query Parameters - **format** (string) - Optional - The desired format for the dataset items (e.g., 'json', 'csv', 'xml'). Defaults to 'json'. - **limit** (integer) - Optional - The maximum number of items to retrieve. Defaults to 250000. - **offset** (integer) - Optional - The number of items to skip before starting to collect the result set. ### Response #### Success Response (200) - **(array of objects)** - A list of dataset items, where each item is an object representing a row in the dataset. ``` -------------------------------- ### Testing CLI Wrapper Script Locally Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/references/cli-actorization.md This snippet demonstrates how to test your CLI wrapper script locally by setting mock input as an environment variable and then executing the script. ```bash # Set up mock input export INPUT='{"myParam": "test-value"}' # Run wrapper script ./start.sh ``` -------------------------------- ### Manual Playwright MCP Configuration Source: https://github.com/apify/agent-skills/blob/main/skills/apify-actorization/SKILL.md Manually add the Playwright MCP server configuration to your MCP config file. This allows for custom server setups. ```json { "mcpServers": { "playwright": { "command": "npx", "args": ["@playwright/mcp@latest"] } } } ``` -------------------------------- ### Authenticate Apify CLI (OAuth) Source: https://github.com/apify/agent-skills/blob/main/commands/create-actor.md Log in to your Apify account using OAuth, which will open a browser for authentication. This is the recommended method. ```bash apify login ```