Overview
When a Cyberdesk workflow reaches a terminal state, you often want structured data as output - not just “task completed.” This page explains how Cyberdesk transforms various types of captured data into structured JSON output that matches your schema.This transformation process works whether your workflow runs from scratch or uses cached trajectories. Dynamic tools like
focused_action and extract_prompt always capture fresh data, even during trajectory replay.The Output Data Pipeline
During workflow execution, Cyberdesk captures data from multiple sources: Observations - Dynamic data extracted by:focused_action- Context-aware decisions and extractionsextract_prompt- Vision-based data extraction (sync, batch, or run-scoped)
copy_to_clipboard- Clipboard-based extractionupsert_runtime_values- Direct variable setting (from async extract_prompt)focused_action- Variable assignment via{{variable}}syntax
output_data JSON matching your schema.
Components of Output Data
1. Output Schemas
Define the structure of your expected output data when creating a workflow. Example Schema:Format:
output_schema must be valid JSON Schema. The one special passthrough marker is {"only_runtime_values": true}, which skips transformation and returns the runtime values map as-is.- Defines expected structure and data types
- Guides the transformation agent
- Enables validation and type checking
- Makes output predictable and consistent
Optional but Recommended: You don’t need an output schema for every workflow, but having one ensures consistent, structured data that’s easy to parse and use in downstream systems.
2. Observations
Captured during workflow execution by multiple tools:- focused_action - Dynamic observations and decisions
- extract_prompt - Vision-based data extraction (sync, batch, or run-scoped)
- The timestamp when the observation was made
- The extracted observation text, or an error when extraction fails
- The screenshot captured at that moment
- Source metadata such as cached/extraction mode details
- In focused actions and some extraction paths, the instruction that produced the observation
- Dynamic: Re-evaluated on every run, even in cached workflows
- Multi-source: From focused_action, extract_prompt (sync/batch/run)
- Contextual: Includes the instruction for clarity
- Visual: Screenshot attached for verification
- Structured: Consistently formatted for transformation
3. Runtime Values
Set during workflow execution via:- focused_action with
{{variable}}syntax - copy_to_clipboard with key names
- extract_prompt with
process_async(batch or run) andupsert_runtime_values
- Immediate: Available as
{{variable_name}}in subsequent workflow steps - Flexible: Can be strings, numbers, or simple objects
- Persistent: Included in final output transformation
- Reusable: Can be used multiple times in workflow
4. The Transformation Agent
At the end of a terminal run, if an output schema is defined, the transformation agent converts all captured observations and runtime values into structured JSON.This includes
success, task_failed, cancelled, and error runs. If a run ends early, Cyberdesk still attempts to generate schema-shaped output_data from the captured data and any schema defaults.- Your defined output schema
- All observations (from focused_action and extract_prompt)
- All runtime values (from copy_to_clipboard, upsert_runtime_values, focused_action)
- Intelligent: Maps observations to schema fields semantically
- Comprehensive: Includes runtime values automatically
- Type-aware: Converts strings to numbers, arrays, etc. as needed
- Validated: Ensures output matches schema structure
Output Data Optimization Features
The transformation agent supports two powerful optimization features to reduce LLM-induced lossiness and improve efficiency.1. Direct Runtime Values Output
If you’ve already collected exactly what you need via runtime variables and don’t need any LLM transformation, you can skip the transformation step entirely. How to Use: Set your output schema to:{"only_runtime_values": true}
Result: The runtime values are returned exactly as collected, with zero lossiness.
When to Use:
- ✅ All data is already in runtime values
- ✅ You want zero LLM-induced modifications
- ✅ Data structure is already exactly what you need
- ✅ You’re using focused actions or extract_prompt extensively to set runtime values
- ⚡ Instant - no LLM transformation call
- 🎯 Zero lossiness - exact values preserved
- 💰 Cheaper - no transformation tokens
- 🔒 Predictable - no chance of LLM hallucination
2. Automatic Runtime Value Referencing
The transformation agent is smart enough to reference existing runtime values directly instead of regenerating them, reducing lossiness and token usage. How It Works: When transforming observations into output data, the transformation agent can automatically detect when a value should come from runtime values instead of being regenerated. It uses internal template syntax to reference these values, which are then deterministically substituted with the exact values. Example: Runtime Values Collected:customer_id, long_transcript, and order_items from runtime values instead of regenerating them, ensuring exact values are preserved.
Benefits:
- 🎯 Zero lossiness - exact runtime values preserved
- ⚡ Faster - less content to generate
- 💰 Cheaper - fewer output tokens
- 🔒 Reliable - no chance of LLM typos in long values
This optimization happens automatically - you don’t need to do anything special. The transformation agent is instructed to use internal referencing when appropriate.
Complete Flow Example
Healthcare Workflow
1. Define Output Schema:Run-Scoped Extraction with Runtime Variables
Run-scoped extractions have a unique capability: they can both store runtime variables AND provide comprehensive observations.The Extraction Agent Loop
When usingprocess_async="run", the extraction becomes a proper agent with access to upsert_runtime_values:
System Prompt:
Example: Store Key Fields + Comprehensive Extraction
- Extraction Agent Analyzes Screenshot
-
Calls upsert_runtime_values:
-
Provides Detailed Observation:
-
Runtime Values Immediately Available:
{{order_id}}can be used in shipping label{{customer_id}}can be used in customer lookup
-
Full Details in Final Output:
- Complete observation included in transformation
- Both runtime values and detailed data in output_data JSON
Benefits
This pattern gives you:- Immediate access to key identifiers via runtime variables
- Non-blocking extraction of comprehensive data
- Single extraction instead of multiple separate calls
- Flexible output tailored to your needs
Best Practices
1. Design Your Schema First
Before writing workflow prompts, define your output schema:2. Use the Right Tool for Each Data Type
3. Set Runtime Variables for Key Identifiers
If a value is used multiple times or in file naming, make it a runtime variable:4. Use Focused Actions for Critical Observations
Use focused_action when:- The observation requires decision-making
- You need to verify something visually
- The data determines workflow branching
- You want to ensure dynamic re-evaluation in cached runs
5. Use Run-Scoped Extraction for Output-Only Data
If data is only needed in final output (not for navigation), use run-scoped:6. Request JSON Format
Always request JSON for structured data:7. Use Async Extraction for Runtime Variables
When usingprocess_async (batch or run), extraction agents can call upsert_runtime_values:
{{order_id}} for later use while also providing comprehensive observations.
8. Include Type Information
Help the transformation agent by specifying types:Common Patterns
Pattern 1: ID + Details
Extract ID first (fast), then comprehensive details (async):Pattern 2: Decision + Data
Make decision synchronously, extract data asynchronously:Pattern 3: Iterative Extraction + Summary
Extract from multiple views, then summarize:Pattern 4: Mixed Sources
Combine all extraction methods:Output Data Access
Via API
After workflow completes, access output_data:Via Webhooks
Receive output_data when run completes:Troubleshooting
Output Data is None
Causes:- No output schema defined
- Transformation failed
- Define an output schema in workflow settings
- Use schema defaults when you want terminal runs with limited captured data to still produce structured output
- Check run logs for transformation errors
Missing Fields in Output
Causes:- Field not captured during workflow
- Field name mismatch between schema and observations
- Transformation couldn’t map observation to field
- Verify observations contain the expected data
- Use clear, descriptive field names in schema
- Request JSON with explicit field names in extractions
Incorrect Data Types
Causes:- Schema specifies number but observation has string
- Vision model returned unexpected format
- Specify types in extraction prompts: “Extract age as number”
- Use runtime values for precise extractions
- Request “as JSON with types: {field: number}“
Runtime Variables Not in Output
Cause:- Transformation agent didn’t include them
- Runtime values are automatically included - check schema field names match variable names
- If mismatch, transformation agent will try to map semantically
Summary
Output data generation in Cyberdesk is a powerful pipeline that combines:- Observations - Dynamic data from focused_action and extract_prompt
- Runtime Values - Immediate identifiers and metrics
- Transformation Agent - Intelligent mapping to your schema
focused_action and extract_prompt tools. They’re all stored together and transformed into the final output.
For detailed information, see:
- Trajectories 101 - How caching and replay work
- Focused Action - Dynamic observations
- Copy to Clipboard - Fast clipboard extraction
- Extract Prompt - Vision-based extraction
- Async Extraction Patterns - Performance optimization