KosmoKrator

automation

Apify CLI for AI Agents

Use the Apify CLI from KosmoKrator to call Apify tools headlessly, return JSON, inspect schemas, and automate workflows from coding agents, scripts, and CI.

10 functions 9 read 1 write API token auth

Apify CLI Setup

Apify can be configured headlessly with `kosmokrator integrations:configure apify`.

# Install KosmoKrator first if it is not available on PATH.
curl -fsSL https://raw.githubusercontent.com/OpenCompanyApp/kosmokrator/main/install.sh | bash

# Configure and verify this integration.
kosmokrator integrations:configure apify --set api_token="$APIFY_API_TOKEN" --enable --read allow --write ask --json
kosmokrator integrations:doctor apify --json
kosmokrator integrations:status --json

Credentials

Authentication type: API token api_token. Configure credentials once, then use the same stored profile from scripts, coding CLIs, Lua code mode, and the MCP gateway.

KeyEnv varTypeRequiredLabel
api_token APIFY_API_TOKEN Secret secret yes API Token
url APIFY_URL URL url no Apify API URL

Call Apify Headlessly

Use the generic call form when another coding CLI or script needs a stable universal interface.

kosmo integrations:call apify.apify_run_actor '{
  "actorId": "example_actorId",
  "input": "example_input",
  "build": "example_build",
  "waitForFinish": 1,
  "timeout": 1,
  "memory": 1
}' --json

Use the provider shortcut form for shorter human-facing commands.

kosmo integrations:apify apify_run_actor '{
  "actorId": "example_actorId",
  "input": "example_input",
  "build": "example_build",
  "waitForFinish": 1,
  "timeout": 1,
  "memory": 1
}' --json

Agent Discovery Commands

These commands return structured output for coding agents that need to inspect capabilities before choosing a function.

kosmo integrations:docs apify --json
kosmo integrations:docs apify.apify_run_actor --json
kosmo integrations:schema apify.apify_run_actor --json
kosmo integrations:search "Apify" --json
kosmo integrations:list --json

All CLI Functions

Every function below can be called headlessly. The generic form is stable across all integrations; the provider shortcut is shorter but specific to Apify.

apify.apify_run_actor

Write write

Run an Apify actor. Provide the actor ID and input configuration to start a new run. Returns the run details including run ID and status. Use apify_get_run to check progress.

Parameters
actorId, input, build, waitForFinish, timeout, memory

Generic CLI call

kosmo integrations:call apify.apify_run_actor '{"actorId":"example_actorId","input":"example_input","build":"example_build","waitForFinish":1,"timeout":1,"memory":1}' --json

Provider shortcut

kosmo integrations:apify apify_run_actor '{"actorId":"example_actorId","input":"example_input","build":"example_build","waitForFinish":1,"timeout":1,"memory":1}' --json

apify.apify_get_run

Read read

Get details and status of an Apify actor run. Returns the run status (READY, RUNNING, SUCCEEDED, FAILED, ABORTED, TIMING-OUT, TIMED-OUT), output dataset ID, and other metadata.

Parameters
runId

Generic CLI call

kosmo integrations:call apify.apify_get_run '{"runId":"example_runId"}' --json

Provider shortcut

kosmo integrations:apify apify_get_run '{"runId":"example_runId"}' --json

apify.apify_list_actors

Read read

List Apify actors available to the authenticated user. Returns actor names, IDs, descriptions, and versions. Supports pagination with offset and limit.

Parameters
offset, limit

Generic CLI call

kosmo integrations:call apify.apify_list_actors '{"offset":1,"limit":1}' --json

Provider shortcut

kosmo integrations:apify apify_list_actors '{"offset":1,"limit":1}' --json

apify.apify_get_actor

Read read

Get details of a specific Apify actor, including its description, input schema, default run options, and available versions. Use this to understand what input an actor requires before running it.

Parameters
actorId

Generic CLI call

kosmo integrations:call apify.apify_get_actor '{"actorId":"example_actorId"}' --json

Provider shortcut

kosmo integrations:apify apify_get_actor '{"actorId":"example_actorId"}' --json

apify.apify_list_datasets

Read read

List Apify datasets accessible to the authenticated user. Returns dataset IDs, names, item counts, and sizes. Supports pagination.

Parameters
offset, limit

Generic CLI call

kosmo integrations:call apify.apify_list_datasets '{"offset":1,"limit":1}' --json

Provider shortcut

kosmo integrations:apify apify_list_datasets '{"offset":1,"limit":1}' --json

apify.apify_get_dataset

Read read

Get details of a specific Apify dataset, including its item count, size, name, and associated actor run. Use apify_get_dataset_items to retrieve the actual data.

Parameters
datasetId

Generic CLI call

kosmo integrations:call apify.apify_get_dataset '{"datasetId":"example_datasetId"}' --json

Provider shortcut

kosmo integrations:apify apify_get_dataset '{"datasetId":"example_datasetId"}' --json

apify.apify_get_dataset_items

Read read

Retrieve items from an Apify dataset. Supports JSON, CSV, and other formats. Use this to get the results from completed actor runs. Datasets are referenced by ID from run results.

Parameters
datasetId, format, limit, offset

Generic CLI call

kosmo integrations:call apify.apify_get_dataset_items '{"datasetId":"example_datasetId","format":"example_format","limit":1,"offset":1}' --json

Provider shortcut

kosmo integrations:apify apify_get_dataset_items '{"datasetId":"example_datasetId","format":"example_format","limit":1,"offset":1}' --json

apify.apify_list_key_value_stores

Read read

List Apify key-value stores accessible to the authenticated user. Key-value stores hold actor outputs like screenshots, PDFs, or JSON results. Supports pagination.

Parameters
offset, limit

Generic CLI call

kosmo integrations:call apify.apify_list_key_value_stores '{"offset":1,"limit":1}' --json

Provider shortcut

kosmo integrations:apify apify_list_key_value_stores '{"offset":1,"limit":1}' --json

apify.apify_get_record

Read read

Get a record from an Apify key-value store by its key. Common keys include "OUTPUT" for actor results, "SCREENSHOT" for page screenshots, or custom keys set by actor runs.

Parameters
storeId, key

Generic CLI call

kosmo integrations:call apify.apify_get_record '{"storeId":"example_storeId","key":"example_key"}' --json

Provider shortcut

kosmo integrations:apify apify_get_record '{"storeId":"example_storeId","key":"example_key"}' --json

apify.apify_get_current_user

Read read

Get the profile of the currently authenticated Apify user. Returns user ID, username, email, plan details, and monthly usage information.

Parameters
none

Generic CLI call

kosmo integrations:call apify.apify_get_current_user '{}' --json

Provider shortcut

kosmo integrations:apify apify_get_current_user '{}' --json

Function Schemas

Use these parameter tables when building CLI payloads without calling integrations:schema first.

apify.apify_run_actor

Run an Apify actor. Provide the actor ID and input configuration to start a new run. Returns the run details including run ID and status. Use apify_get_run to check progress.

Operation
Write write
Schema command
kosmo integrations:schema apify.apify_run_actor --json
ParameterTypeRequiredDescription
actorId string yes The actor ID (e.g., "apify/web-scraper", "apify/cheerio-scraper") or numeric ID.
input object yes The input configuration for the actor run. Structure depends on the specific actor.
build string no Actor build to use (e.g., "latest", "beta"). Defaults to the latest build.
waitForFinish integer no Maximum seconds to wait for the run to finish (0–300). Defaults to 0 (return immediately).
timeout integer no Timeout for the actor run in seconds. Overrides the actor's default timeout.
memory integer no Memory allocation in megabytes (128, 256, 512, 1024, 2048, 4096, 8192). Overrides the actor's default.

apify.apify_get_run

Get details and status of an Apify actor run. Returns the run status (READY, RUNNING, SUCCEEDED, FAILED, ABORTED, TIMING-OUT, TIMED-OUT), output dataset ID, and other metadata.

Operation
Read read
Schema command
kosmo integrations:schema apify.apify_get_run --json
ParameterTypeRequiredDescription
runId string yes The actor run ID.

apify.apify_list_actors

List Apify actors available to the authenticated user. Returns actor names, IDs, descriptions, and versions. Supports pagination with offset and limit.

Operation
Read read
Schema command
kosmo integrations:schema apify.apify_list_actors --json
ParameterTypeRequiredDescription
offset integer no Number of actors to skip (default: 0).
limit integer no Maximum number of actors to return (default: 20, max: 1000).

apify.apify_get_actor

Get details of a specific Apify actor, including its description, input schema, default run options, and available versions. Use this to understand what input an actor requires before running it.

Operation
Read read
Schema command
kosmo integrations:schema apify.apify_get_actor --json
ParameterTypeRequiredDescription
actorId string yes The actor ID (e.g., "apify/web-scraper") or numeric ID.

apify.apify_list_datasets

List Apify datasets accessible to the authenticated user. Returns dataset IDs, names, item counts, and sizes. Supports pagination.

Operation
Read read
Schema command
kosmo integrations:schema apify.apify_list_datasets --json
ParameterTypeRequiredDescription
offset integer no Number of datasets to skip (default: 0).
limit integer no Maximum number of datasets to return (default: 20, max: 1000).

apify.apify_get_dataset

Get details of a specific Apify dataset, including its item count, size, name, and associated actor run. Use apify_get_dataset_items to retrieve the actual data.

Operation
Read read
Schema command
kosmo integrations:schema apify.apify_get_dataset --json
ParameterTypeRequiredDescription
datasetId string yes The dataset ID.

apify.apify_get_dataset_items

Retrieve items from an Apify dataset. Supports JSON, CSV, and other formats. Use this to get the results from completed actor runs. Datasets are referenced by ID from run results.

Operation
Read read
Schema command
kosmo integrations:schema apify.apify_get_dataset_items --json
ParameterTypeRequiredDescription
datasetId string yes The dataset ID (e.g., from a run's defaultDatasetId).
format string no Response format: "json" (default), "csv", "xml", "html", "xlsx", "rss", or "jsonl".
limit integer no Maximum number of items to return (default: 100).
offset integer no Number of items to skip (default: 0).

apify.apify_list_key_value_stores

List Apify key-value stores accessible to the authenticated user. Key-value stores hold actor outputs like screenshots, PDFs, or JSON results. Supports pagination.

Operation
Read read
Schema command
kosmo integrations:schema apify.apify_list_key_value_stores --json
ParameterTypeRequiredDescription
offset integer no Number of stores to skip (default: 0).
limit integer no Maximum number of stores to return (default: 20, max: 1000).

apify.apify_get_record

Get a record from an Apify key-value store by its key. Common keys include "OUTPUT" for actor results, "SCREENSHOT" for page screenshots, or custom keys set by actor runs.

Operation
Read read
Schema command
kosmo integrations:schema apify.apify_get_record --json
ParameterTypeRequiredDescription
storeId string yes The key-value store ID (e.g., from a run's defaultKeyValueStoreId).
key string yes The record key (e.g., "OUTPUT", "SCREENSHOT", or a custom key).

apify.apify_get_current_user

Get the profile of the currently authenticated Apify user. Returns user ID, username, email, plan details, and monthly usage information.

Operation
Read read
Schema command
kosmo integrations:schema apify.apify_get_current_user --json
ParameterTypeRequiredDescription
No parameters.

Permissions

Headless calls still follow the integration read/write permission policy. Configure read/write defaults with integrations:configure. Add --force only for trusted automation that should bypass that policy.