Skip to main content

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 extractions
  • extract_prompt - Vision-based data extraction (sync, batch, or run-scoped)
Runtime Values - Variables set by:
  • copy_to_clipboard - Clipboard-based extraction
  • upsert_runtime_values - Direct variable setting (from async extract_prompt)
  • focused_action - Variable assignment via {{variable}} syntax
At terminal completion, the Transformation Agent combines all observations and runtime values to generate structured 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.
Purpose:
  • 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: How They’re Created: Via focused_action:
Via extract_prompt (any mode):
What Gets Stored:
  • 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
Example Observation Entries: From focused_action:
From extract_prompt (with source field):
Key Characteristics:
  • 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: How They’re Created: Via Focused Action:
Via Copy to Clipboard:
Via Async Extraction (batch or run scoped):
or
What Gets Stored:
Key Characteristics:
  • 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
Runtime values are perfect for:
  • IDs and reference numbers needed later in workflow
  • Values used in file naming or path construction
  • Data that determines workflow branching
  • Key metrics that appear in multiple places in output

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.
Input to Transformation Agent:
  1. Your defined output schema
  2. All observations (from focused_action and extract_prompt)
  3. All runtime values (from copy_to_clipboard, upsert_runtime_values, focused_action)
Process:
System Prompt (simplified):
Key Characteristics:
  • 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:
This immediately returns the runtime values map as-is, without any LLM processing. Example:
Runtime Values Collected:
Output Schema: {"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
Benefits:
  • ⚡ 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:
Observations:
Output Schema:
Final Output (automatic optimization):
The transformation agent automatically references 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:
2. Workflow Execution:
3. Data Captured During Execution: Runtime Values (from copy_to_clipboard):
Focused Observations (from focused_action):
Extraction Results (from extract_prompt):
4. Transformation (at run completion): The transformation agent receives all captured data and the schema, then produces:
This structured output is now available via the API and can be used by downstream systems!

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 using process_async="run", the extraction becomes a proper agent with access to upsert_runtime_values: System Prompt:

Example: Store Key Fields + Comprehensive Extraction

What Happens:
  1. Extraction Agent Analyzes Screenshot
  2. Calls upsert_runtime_values:
  3. Provides Detailed Observation:
  4. Runtime Values Immediately Available:
    • {{order_id}} can be used in shipping label
    • {{customer_id}} can be used in customer lookup
  5. 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 using process_async (batch or run), extraction agents can call upsert_runtime_values:
This stores {{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
Solutions:
  • 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
Solutions:
  • 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
Solutions:
  • 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
Solution:
  • 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:
  1. Observations - Dynamic data from focused_action and extract_prompt
  2. Runtime Values - Immediate identifiers and metrics
  3. Transformation Agent - Intelligent mapping to your schema
All observations (whether from focused_action or extract_prompt) are stored together and transformed into structured output. By understanding this pipeline and using the right tools for each data type, you can build workflows that produce consistent, structured output data ready for integration with any downstream system. Note: The observations list contains data from both focused_action and extract_prompt tools. They’re all stored together and transformed into the final output. For detailed information, see: