A small SDK connects runtime errors, service costs, and admission rules to your ActorConsole workspace.
ACTORCONSOLE_KEY as a secret environment variable in Apify Console. Keep it out of Actor input, source code, and logs.import { Actor } from 'apify';
import { withActorConsole } from './actorconsole.mjs';
await Actor.init();
await withActorConsole(async (console) => {
// Put your existing Actor work here.
// Report paid services using a stable transaction ID:
// await console.trackCost('AI API', 0.012, { eventId: 'provider-txn-id' });
});
await Actor.exit();from apify import Actor
from actorconsole import ActorConsole
async def main():
async with Actor:
async with ActorConsole() as console:
# Put your existing Actor work here.
# await console.track_cost('AI API', 0.012, event_id='provider-txn-id')
passError and expense reports are best effort: a reporting outage leaves Actor work running. Run admission is checked before work starts and fails closed if the service is unavailable. Rules apply only after you integrate the SDK. Local development bypasses admission checks; paying users are exempt.
The SDK reads the run ID, initiating user, and paid status from Apify environment variables. Never override these values using Actor input. Memory samples cover the reporting process and exclude child processes. Input is not collected automatically; include only debugging context you need. Common credential fields are redacted, but custom context still needs care.
Run samples and error events are retained for 90 days. Grouped issue totals and expense records remain until their Actor or account is deleted. Admission records last 100 days; lifetime counters persist for lifetime limits.
Apify environment variable reference