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 is omitted
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="batch"
Behavior: When multiple screenshot extractions run in the same batched tool phase, they run in parallel and complete before the next agent step. If Cyberdesk executes the screenshot as a standalone tool call instead, it falls back to synchronous extraction.
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
extract_prompt call, the extraction agent can call upsert_runtime_values when your prompt explicitly tells it to save or store values. In batch mode, those values become available before the next agent step once the batch finishes.
Example:
Run-Scoped Async
When:process_async="run"
Behavior: Extraction runs completely in background for entire workflow, only awaited at final output generation
Requirement: The workflow must have an output_schema; otherwise Cyberdesk returns an error and asks you to use synchronous or batch mode instead
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
extract_prompt call, the extraction agent can call upsert_runtime_values when your prompt explicitly tells it to save or store values. In run scope, those values become available once the background extraction finishes.
Example:
Comparing the Modes
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)
Extraction Modes with Runtime Variables
Allextract_prompt modes use the extraction agent, and that agent can call upsert_runtime_values when your prompt explicitly tells it to save or store runtime values. The main difference is timing:
Synchronous: Variables are available immediately when the extraction returns
Batch-Scoped: Variables are available before the next agent step once the batch finishes
Run-Scoped: Variables are available when the background extraction completes
The Extraction Agent
Everyextract_prompt call uses the extraction agent. Async modes (batch and run) add concurrency on top of the same capabilities:
- Call upsert_runtime_values to store specific fields
- Provide final observations as text
- Do both: Store values AND provide observations
System Prompt (All Extraction Modes)
When an extraction runs, the extraction agent receives guidance like:Example: Synchronous with Runtime Variables (Available Immediately)
- Screenshot taken
- Extraction agent analyzes screenshot
- Calls
upsert_runtime_values({customer_id: "C-1024", membership_tier: "Gold"}) - Provides observation about the visible account status
- Variables are available immediately when the extraction returns
- Agent proceeds with
{{customer_id}}and{{membership_tier}}available
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
Array and Object Operators
When accumulating data across multiple extractions (e.g., scrolling through a list), use MongoDB-style operators to append to arrays instead of replacing values:Example: Accumulating Extracted Items Across Pages
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:
*Run-scoped shows 0s blocking time but still processes in background; workflow continues unblocked
Common Patterns Summary
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 or values you need immediately.
- 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