What are Apify Actors?
Apify Actors are serverless cloud programs that can perform anything from a simple action, like filling out a web form, to a complex operation, like crawling an entire website. They are programs packaged as Docker images, which accept a well-defined JSON input, perform an action, and optionally produce a well-defined JSON output.Key Features
- Serverless Execution: No infrastructure management required, just deploy and run
- Stateful Operations: Actors can maintain state across executions, enabling runs from seconds to hours, or even indefinitely
- Flexible I/O: Accept JSON input and produce JSON output with well-defined schemas
- Built-in Storage: Access to datasets, key-value stores, and request queues
- Composable: Actors can call and interact with each other to build complex systems
Actor Structure
Each Apify Actor consists of:- Dockerfile: Manages code location, build process, and execution instructions
- Source Code: Your application logic (Python, Node.js, or other languages)
- Input/Output Schemas: Define required inputs and produced results
- README Documentation: Explains functionality for users
- Metadata: Actor name, description, author, and version
Getting Started
Add Agnost AI analytics to your Apify Actor in four simple steps:1. Get Your Project ID
Get your project ID from app.agnost.ai2. Install Agnost AI
- Python
- Node.js
agnost-mcp 0.2.0 does not yet support mcp 2.x; keep the pin.3. Add One Line of Code
- Python
- Node.js
track after registering your call_tool handler; calling it
earlier records nothing.
4. View Metrics
Visit app.agnost.ai to view your analytics:- Monitor MCP tool calls served by your Actor in real-time
- Track performance and latency
- Analyze success and failure rates
- Identify optimization opportunities
Configuration
Customize tracking behavior with configuration options:- Python
- Node.js
Configuration Options
UserIdentity is a dict (Python) or object (Node) that must contain a
userId key. Other fields such as email and role are optional and forwarded
as user traits.
User Identification
Track analytics per user to understand usage patterns across different customers or projects running your Actor.- Python
- Node.js
Common Use Cases
- Multi-tenant Actors: Track which customer or project is using the Actor
- Subscription Tiers: Segment analytics by free, pro, or enterprise users
- Cost Attribution: Understand usage and costs per customer
- Customer Success: Monitor individual customer health and engagement
Complete Example
- Python
- Node.js
Why Add Analytics to Your Actor?
Performance Optimization
- Identify slow operations and bottlenecks
- Track execution time trends over versions
- Optimize resource usage and costs
Usage Insights
- Monitor how customers use your Actor
- Understand which features are most popular
- Identify usage patterns and trends
Error Tracking
- Track failure rates and error patterns
- Debug issues faster with detailed context
- Monitor service reliability
Business Intelligence
- Segment users by subscription tier
- Track adoption and retention
- Make data-driven decisions for features and pricing
Verify
Call one MCP tool on your Actor’s server, then open app.agnost.ai. Check Events first, then Tool calls. Actor runs that don’t handle an MCP tool call produce no events.Troubleshooting
- Confirm
track(...)ortrackMCP(...)runs before Actor tool calls. In Python, it must also run after yourcall_toolhandler is registered; otherwise the log showsNo CallToolRequest handler found. - In Python, confirm
pip show mcpreports a version below 2. - Confirm the project ID is correct.
- Confirm Actor input fields used in
identifyare present.
Resources
- Python setup: SDK configuration and identification
- Apify Actors Documentation: Learn about Apify Actors
- Apify Actors Development: Development guide
Need Help?
- Email: [email protected]
- Book a call
Next steps
- Tool calls: analyze Actor tool usage and outcomes.
- Events: inspect the records emitted by an Actor run.
- Alerts: monitor important Actor conditions.