AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { createAction } from '@activepieces/pieces-framework';
import { apifyAuth } from '../..';
import {
createApifyClient,
createBuildProperty,
createRunOptions,
handleRun,
createActorSourceProperty,
createActorIdProperty,
createActorInputProperty,
createMemoryProperty,
createTimeoutProperty,
createWaitForFinishProperty,
RunType
} from '../common';
import { runActorActionOutputSchema } from '../output-schemas';
export const runActor = createAction({
name: 'runActor',
classification: 'WRITE',
auth: apifyAuth,
displayName: 'Run Actor',
description: 'Runs an Actor and, if you wait, returns its results.',
audience: 'human',
outputSchema: runActorActionOutputSchema,
aiMetadata: { description: 'Starts an Apify Actor (a hosted scraper/automation program) by actor ID, passing a JSON input body and optional build/memory/timeout settings. Use this to execute a specific Actor for scraping or data extraction; set waitForFinish to block until the run completes and fetch its dataset items. Not idempotent — each call launches a new actor run.', idempotent: false },
props: {
actorSource: createActorSourceProperty(),
actorid: createActorIdProperty(),
input: createActorInputProperty(),
build: createBuildProperty(),
memory: createMemoryProperty(RunType.ACTOR),
timeout: createTimeoutProperty(RunType.ACTOR),
waitForFinish: createWaitForFinishProperty()
},
propertyGroups: [
{ key: 'actor', display: 'section', label: 'What to Run', icon: 'send', props: ['actorSource', 'actorid'] },
{ key: 'input', display: 'section', label: 'What to Send', icon: 'code', props: ['input'] },
{ key: 'result', display: 'section', label: 'Results', icon: 'inbox', props: ['waitForFinish'] },
],
async run(context) {
const apifyToken = context.auth.props.apikey;
const { input, actorid, timeout, build, memory, waitForFinish } = context.propsValue;
const body = input['body'];
const client = createApifyClient(apifyToken);
const runOptions = createRunOptions({ timeout, memory, build });
const resourceClient = client.actor(actorid);
return handleRun({
resourceClient,
body,
runOptions,
waitForFinish: waitForFinish || false,
client
});
},
});