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 } from '../common';
import { getAccountLimitsActionOutputSchema } from '../output-schemas';
export const apifyGetAccountLimits = createAction({
name: 'apify_get_account_limits',
classification: 'READ',
auth: apifyAuth,
displayName: 'Get Account Limits',
description: 'Retrieves the authenticated account\'s plan limits and current usage.',
audience: 'ai',
outputSchema: getAccountLimitsActionOutputSchema,
aiMetadata: {
description:
'Get the account\'s plan limits and current usage (e.g. max concurrent runs, monthly compute). Use this to decide whether a run will fit the plan before starting it with Run Actor, or to explain a usage-limit error. Use Get Account for the profile. Read-only and idempotent.',
idempotent: true,
},
props: {},
async run(context) {
const apifyToken = context.auth.props.apikey;
const client = createApifyClient(apifyToken);
try {
const limits = await client.user('me').limits();
return limits;
} catch (error: any) {
if (error.statusCode === 401) {
throw new Error('Invalid Apify API token.');
}
if (error.statusCode === 429) {
throw new Error('Apify rate limit exceeded. Retry after a short delay.');
}
throw new Error(`Failed to get account limits: ${error.message || error}`);
}
},
});