Quick steps to execute Workflows externally
Step 1: Design Your Workflow in Agent Studio UI
What You’re Doing: Creating your workflow visually instead of writing complex JSON manually. Why This Matters: The Agent Studio visual builder automatically generates the correct JSON structure for you - no need to understand complex workflow syntax or risk JSON errors. How to Do It:- Open Agent Studio visual workflow builder
- Drag and drop nodes (agents, APIs, conditionals) onto the canvas
- Connect nodes with lines to define the flow
- Configure each node’s parameters in the UI
- CRITICAL: Click on Workflow API
- Copy the entire
workflow_data
JSON structure
Step 2: Execute Your Workflow via run-dag API
What You’re Doing: Taking the JSON from Step 1 and executing it with real data. Why This Matters: This is where your visual workflow becomes a running process that does actual work (processes data, calls APIs, makes decisions). How to Do It:workflow_data
: The complete JSON from your visual builder (Step 1)inputs
: The actual data you want to process (overrides default values)- Response contains the results from each node in your workflow
Step 3: Monitor Execution with WebSocket Events
What You’re Doing: Getting real-time updates as your workflow runs. Why This Matters: For enterprise use, you need to know immediately when workflows complete, fail, or need attention. Don’t wait for polling - get instant notifications. How to Do It:- Real-time progress updates as each node executes
- Immediate error notifications if something fails
- Final results as soon as the workflow completes
- Ability to update users and trigger other systems instantly
Executing workflow via run-dag Endpoint
What This Is: The core API endpoint that takes your visual workflow and executes it with real data. URL:https://lao.studio.lyzr.ai/run-dag/
Method: POST
Purpose: Execute any workflow with real-time monitoring Why You Use This: This is where your designed workflow becomes a running automation that processes data, calls APIs, makes decisions, and produces results.
Request Structure Explained
workflow_data
= Your workflow template (same every time)inputs
= The specific data for THIS execution (changes each time)
How to Get workflow_data JSON
🎯 Method 1: Agent Studio Visual Builder ⭐ Always Use This What You’re Doing: Getting the perfect JSON without any manual work. Step-by-Step:- Open Agent Studio workflow builder
- Design your workflow visually (drag, drop, connect nodes)
- Click “Export JSON” or “Get API Code” button in the UI
- Copy the ENTIRE
workflow_data
JSON structure - Paste it into your API calls
🔧 Method 2: Workflow Management API (For Existing Workflows) What You’re Doing: Retrieving a workflow you already created and saved.
❌ Method 3: Manual Construction (NEVER Do This) What This Means: Writing the complex JSON structure by hand. Why You Don’t Do This:
- Extremely complex JSON structure with nested dependencies
- Easy to make syntax errors that break execution
- Hard to maintain and debug
- The visual builder does this perfectly for you
Response Structure
Initial Response (Immediate):- Your workflow has been accepted and is now running
- Use the
task_id
to track the execution - Connect to WebSocket using your
flow_name
andrun_name
to monitor progress - The workflow continues executing asynchronously
Getting Final Results via Task Status API
What This Is: An alternative way to get workflow results after execution completes, using the task_id from the initial response. When to Use This:- When you can’t use WebSocket connections (firewall restrictions, etc.)
- When you need to retrieve results later (hours/days after execution)
- As a backup method to ensure you capture results
Task Status Endpoint
URL:https://lao.studio.lyzr.ai/task-status/{task_id}
Method: GET
Purpose: Retrieve the final results of a completed workflow
Example Request
Response While Processing
Important: This endpoint returnsprocessing
status while the workflow is still running. You’ll need to poll periodically or use WebSocket for real-time updates.
Response After Completion
Once the workflow finishes, you get the complete results from all nodes:status
: Either “processing” or “completed”results
: Object containing output from each node (keyed by node name)- Each node’s complete output data