Metamorph
Pricing
Pay per usage
Metamorph
This Actor demonstrates the Apify metamorph operation by processing multiple URLs with configurable delays, then transforming into another Actor to complete the work in a single continuous run.
Pricing
Pay per usage
Rating
5.0
(2)
Developer

dz_omar
Actor stats
2
Bookmarked
3
Total users
3
Monthly active users
2 months ago
Last modified
Categories
Share
Batch Metamorph Actor 🔄
This Actor demonstrates the Apify metamorph operation by processing multiple URLs with configurable delays, then transforming into another Actor to complete the work in a single continuous run.
What This Actor Does
- Accepts multiple URLs in
requestListSourcesformat (compatible with Crawlee) - Processes URLs sequentially with a configurable delay between each
- Stores processing metadata in the key-value store to demonstrate data persistence
- Metamorphs into
dz_omar/universal-downloaderwith all URLs as a batch job
Key Features
🔄 Metamorph Operation
The metamorph operation allows one Actor to transform into another Actor mid-execution while preserving all storage data (Dataset, Key-Value Store, Request Queue). This happens seamlessly in a single run with one billing cycle.
⏱️ Configurable Delays
Add delays between URL processing to avoid overwhelming target servers or respect rate limits.
📊 Data Persistence
All data stored before the metamorph (processing logs, timestamps, metadata) remains accessible after the transformation.
Input Configuration
The Actor accepts input in this format:
{"input": [{ "url": "https://httpbin.org/bytes/1024" },{ "url": "https://httpbin.org/bytes/2048" },{ "url": "https://httpbin.org/bytes/4096" }],"delaySeconds": 3}
Input Fields
input(Array, required): List of URLs inrequestListSourcesformat- Compatible with Crawlee's RequestList sources
- Supports both
{ "url": "..." }objects and plain strings
delaySeconds(Integer, optional): Fixed delay between processing each URL- Default: 2 seconds
- Range: 0-60 seconds
How It Works
-
Phase 1 - Your Actor:
- Processes each URL with delays
- Stores metadata for each step
- Logs progress and timing
-
Phase 2 - Metamorph:
- Transforms into
universal-downloader - Passes all URLs as batch input
- Continues in the same run ID
- Transforms into
-
Phase 3 - Target Actor:
- Downloads all files
- Stores results in dataset
- Completes the workflow
Example Output
Console Logs:
Processing 3 URLs with 3 second delay between requestsProcessing URL 1/3: https://httpbin.org/bytes/1024Waiting 3 seconds before next URL...Processing URL 2/3: https://httpbin.org/bytes/2048Waiting 3 seconds before next URL...Processing URL 3/3: https://httpbin.org/bytes/4096This is the last URL - METAMORPHING into universal-downloader...[Then universal-downloader logs continue...]
Key-Value Store:
BATCH_INFO: Overall batch informationPROCESSING_0,PROCESSING_1, etc.: Individual URL processing logs
Dataset:
- Download results from universal-downloader
Benefits of Metamorph
✅ Single Run Billing: Pay for one continuous run instead of multiple Actor calls
✅ Data Persistence: All storage survives the transformation
✅ Seamless Integration: No manual coordination between Actors
✅ Simplified Workflows: Chain complex operations easily
✅ Cost Effective: Reduce overhead of multiple Actor starts
Use Cases
- Batch File Processing: Download multiple files with rate limiting
- Workflow Orchestration: Chain specialized Actors together
- Complex Scraping: Analyze targets, then use appropriate scrapers
- Data Pipeline: Transform data through multiple processing stages
Learn More About Metamorph
Official Documentation
Technical Details
- Storage Persistence: All default storages (Dataset, Key-Value Store, Request Queue) are preserved
- Input Handling: Metamorphed Actor receives input via
INPUT-METAMORPH-1key (handled automatically byActor.getInput()) - Billing: Single run ID for the entire workflow
- Limitations: Runtime limits apply to the total metamorph chain
Related Concepts
- Crawlee RequestList: Compatible input format
- Apify SDK: JavaScript SDK for Actor development
- Actor Development: Complete development guide
Error Handling
The Actor includes error handling for:
- Invalid URL formats in input
- Missing or malformed input data
- Metamorph operation failures
- Delay parameter validation
Deployment
- Push to Apify platform:
apify push - Configure input in Console or via API
- Run and monitor the metamorph workflow
- Check both phases in the same run logs
Note: This is an educational demonstration of the metamorph operation. In production, consider additional error handling, input validation, and monitoring based on your specific needs.
🤝 Support & Resources
Getting Help
- 📧 Email: fridaytechnolog@gmail.com
- 🐙 GitHub: DZ-ABDLHAKIM
- 🐦 Twitter: @DZ_45Omar
- 🔧 Apify: dz_omar


