Skip to main content

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
Example:
Timing Diagram:

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
Runtime Values: Like any 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:
Timing Diagram:
Performance Benefit: 3-5x faster than synchronous when extracting from multiple views in one batched phase

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
Runtime Values: Like any 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:
Timing Diagram:
Performance Benefit: Maximum parallelism, zero blocking time during workflow execution

Comparing the Modes

Performance Examples

Scenario: Extract from 10 Pages of Data

Synchronous:
Batch-Scoped:
Run-Scoped (if extraction not needed for navigation):

Advanced Pattern: Hybrid Extraction

Combine multiple modes for optimal performance:
Result:
  • 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

All extract_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

Every extract_prompt call uses the extraction agent. Async modes (batch and run) add concurrency on top of the same capabilities:
  1. Call upsert_runtime_values to store specific fields
  2. Provide final observations as text
  3. 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)

What Happens:
  1. Screenshot taken
  2. Extraction agent analyzes screenshot
  3. Calls upsert_runtime_values({customer_id: "C-1024", membership_tier: "Gold"})
  4. Provides observation about the visible account status
  5. Variables are available immediately when the extraction returns
  6. Agent proceeds with {{customer_id}} and {{membership_tier}} available

Example: Batch-Scoped with Runtime Variables (Available Before Next Step)

What Happens:
  1. Screenshot taken
  2. Extraction agent analyzes screenshot
  3. Calls upsert_runtime_values({order_id: "ORD-123"})
  4. Provides observation about status and customer
  5. All batch extractions complete in parallel
  6. Variables available before next agent step - can be used immediately
  7. Agent proceeds with {{order_id}} available

Example: Run-Scoped with Runtime Variables (Available When Extraction Completes)

What Happens:
  1. Extraction starts in background
  2. Workflow continues with other tasks
  3. Extraction agent analyzes screenshot (in background)
  4. Calls upsert_runtime_values({invoice_date: "2024-01-15", total_amount: 1250.00})
  5. Variables become available once extraction completes
  6. Agent then provides detailed observation about line items, taxes, etc.
  7. 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

The $append operator creates the array if it doesn’t exist, so you don’t need to initialize {{products}} before the first extraction.

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:
After:
Benefit: 3x faster with no other changes

From Batch-Scoped to Run-Scoped

Before:
After:
Benefit: Zero blocking time, maximum parallelism Caution: Only use if extraction result not needed for navigation

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.
Choose based on when you need the data, not just “async is faster” - the right pattern depends on your workflow structure. For more information, see: