Overview
Cyberdesk provides flexible async extraction modes that let you optimize workflow performance based on when and how you need extracted data. Understanding these patterns is key to building fast, efficient workflows.Async extraction works seamlessly with Cyberdesk’s trajectory caching system. During trajectory replay, extract prompts re-execute to capture fresh data, so you get both the speed benefits of caching and the flexibility of dynamic data extraction.
The Three Processing Modes
Synchronous (Default)
When:process_async not set, false, or None
Behavior: Extraction blocks until complete
Processing Time: 2-5 seconds per extraction
Use When:
- You need the result immediately for the next decision
- Extracting a single value
- The extraction determines workflow branching
- Simple workflows with < 5 total extractions
Batch-Scoped Async
When:process_async=true or process_async="batch"
Behavior: All extractions in the current tool call batch run in parallel, complete before next agent step
Processing Time: ~3 seconds for entire batch (no matter how many extractions)
Use When:
- Scrolling through lists or paginated content
- Extracting from multiple sequential views
- Extractions don’t depend on each other
- Results should be ready for next agent decision
- Want to store runtime variables from extractions before next agent turn
upsert_runtime_values tool - can store specific values AND provide observations
Example:
Run-Scoped Async
When:process_async="run"
Behavior: Extraction runs completely in background for entire workflow, only awaited at final output generation
Processing Time: Non-blocking, completes while workflow continues
Use When:
- Large data extractions not needed for navigation
- Extraction is only for final output
- You want maximum parallelism
- Need to set runtime variables from extraction that won’t be used until later
upsert_runtime_values tool - can store specific values AND provide observations
Example:
Comparing the Modes
| Aspect | Synchronous | Batch-Scoped | Run-Scoped |
|---|---|---|---|
| Blocking | ✅ Blocks each time | ✅ Blocks at end of batch | ❌ Non-blocking |
| Parallelism | ❌ Sequential | ✅ Within batch | ✅ Across entire run |
| Best For | Single extraction, decisions | Lists, pagination | Large output data |
| Result Available | Immediately | Before next step | At final output |
| Runtime Variables | ❌ No | ✅ Yes (via upsert_runtime_values) | ✅ Yes (via upsert_runtime_values) |
| Performance | Slowest (N × 3s) | Fast (3s per batch) | Fastest (0s blocking) |
Performance Examples
Scenario: Extract from 10 Pages of Data
Synchronous:Advanced Pattern: Hybrid Extraction
Combine multiple modes for optimal performance:- Fast decision making (synchronous where needed)
- Efficient list processing (batch-scoped parallelism)
- Zero blocking for large data (run-scoped for final output)
Async Extractions with Runtime Variables
Both batch-scoped and run-scoped extractions have a powerful capability: the extraction agent can callupsert_runtime_values to make specific extracted values available as runtime variables. The difference is in timing:
Batch-Scoped: Variables available before next agent step (good for iterative workflows)
Run-Scoped: Variables available when extraction completes (good for background processing)
The Agent Loop
When usingprocess_async (either “batch” or “run”), the extraction becomes a proper agent that can:
- Call upsert_runtime_values to store specific fields
- Provide final observations as text
- Do both: Store values AND provide observations
System Prompt (Any Async Mode)
When using batch or run scoped extraction, the extraction agent receives:Example: Batch-Scoped with Runtime Variables (Available Before Next Step)
- Screenshot taken
- Extraction agent analyzes screenshot
- Calls
upsert_runtime_values({order_id: "ORD-123"}) - Provides observation about status and customer
- All batch extractions complete in parallel
- Variables available before next agent step - can be used immediately
- Agent proceeds with
{{order_id}}available
Example: Run-Scoped with Runtime Variables (Available When Extraction Completes)
- Extraction starts in background
- Workflow continues with other tasks
- Extraction agent analyzes screenshot (in background)
- Calls
upsert_runtime_values({invoice_date: "2024-01-15", total_amount: 1250.00}) - Variables become available once extraction completes
- Agent then provides detailed observation about line items, taxes, etc.
- Both the runtime variables and observation text are included in final output
Example: Pure Observation (No Runtime Variables)
Example: Multiple Runtime Variables
Choosing the Right Mode
Use this decision tree:Real-World Patterns
Healthcare: Patient Record Processing
E-Commerce: Inventory Extraction
Finance: Transaction Processing
Best Practices
1. Start with Synchronous, Optimize Later
Begin with simple synchronous extraction, then optimize bottlenecks:2. Use Batch-Scoped for Lists
Any time you’re iterating (scrolling, clicking next, navigating pages), use batch-scoped:3. Use Run-Scoped for Final Output Only
If the extracted data doesn’t influence navigation or decisions, make it run-scoped:4. Combine with Other Extraction Methods
Use copy_to_clipboard for fast copyable text, and extract_prompt for vision-based extraction:5. Set Runtime Variables from Run-Scoped Extractions
When you need specific values mid-workflow but also want large extractions:Performance Metrics
Based on typical workflow patterns:| Scenario | Synchronous | Batch-Scoped | Run-Scoped | Speedup |
|---|---|---|---|---|
| 1 extraction | 3s | 3s | 0s* | 1x |
| 5 extractions (sequential) | 15s | 3-6s | 0s* | 2.5-5x |
| 10 extractions (sequential) | 30s | 9-12s | 0s* | 2.5-10x |
| 20 extractions (sequential) | 60s | 18-24s | 0s* | 2.5-10x |
Common Patterns Summary
| Pattern | Mode | Example |
|---|---|---|
| Decision Making | Synchronous | ”Extract status to determine next step” |
| List Processing | Batch-Scoped | ”Scroll and extract from each page” |
| Final Output Data | Run-Scoped | ”Extract analytics for report” |
| Runtime Variables | Run-Scoped | ”Extract and store ID for later use” |
| Mixed Requirements | Hybrid | Sync for decisions + Batch for lists + Run for output |
Migration Guide
From Synchronous to Batch-Scoped
Before:From Batch-Scoped to Run-Scoped
Before:Summary
- Synchronous: Simple, reliable, blocks until complete. Use for decisions.
- Batch-Scoped: Parallel within batch, 3-5x faster for lists. Use for iteration.
- Run-Scoped: Maximum parallelism, zero blocking. Use for output-only data.
- Extract Prompt - Detailed extraction syntax and examples
- Trajectories 101 - How caching amplifies these performance benefits