---
title: "Agentic Browser V2"
method: POST
path: "/v1/workflows/execute"
tags: ["AgenticScrapper"]
---

# Agentic Browser V2

`POST /v1/workflows/execute`

## Request body

- WorkflowDefinition — Main workflow definition
  - `workflow_id` string, nullable — Unique workflow identifier
  - `name` string, required — Human-readable workflow name
  - `description` string, nullable — Workflow description
  - `start_url` string, nullable — Initial URL to navigate to (can be overridden)
  - `use_session` boolean — Whether to use persistent browser session
  - `steps` union[], required — Ordered list of workflow steps
    - union
      - NavigationStep — Navigate to a URL
        - `type` 'navigate' | 'action' | 'extract' | 'loop' | 'conditional' | 'subworkflow' | 'wait' | 'extract_markdown' — Types of workflow steps
        - `url` string, required — URL to navigate to. Supports variable interpolation: {{variable_name}}
        - `wait_for` string, nullable — Optional selector to wait for after navigation
      - ActionStep — Perform an action on the page
        - `type` 'navigate' | 'action' | 'extract' | 'loop' | 'conditional' | 'subworkflow' | 'wait' | 'extract_markdown' — Types of workflow steps
        - `action` string, required — Natural language action description (e.g., 'Click login button', 'Fill email with {{email}}')
        - `observe_first` boolean — Whether to observe elements before acting
      - ExtractionStep — Extract data from the page
        - `type` 'navigate' | 'action' | 'extract' | 'loop' | 'conditional' | 'subworkflow' | 'wait' | 'extract_markdown' — Types of workflow steps
        - `instruction` string, required — What to extract (e.g., 'Extract all product links from the page')
        - `schema` object, nullable — Optional schema for structured extraction
        - `save_to` string, required — Variable name to save extracted data to (e.g., 'product_links')
      - MarkdownExtractionStep — Extract markdown from the page
        - `type` 'navigate' | 'action' | 'extract' | 'loop' | 'conditional' | 'subworkflow' | 'wait' | 'extract_markdown' — Types of workflow steps
        - `save_to` string, required — Variable name to save extracted markdown to (e.g., 'markdown')
      - LoopStep — Iterate over an array
        - `type` 'navigate' | 'action' | 'extract' | 'loop' | 'conditional' | 'subworkflow' | 'wait' | 'extract_markdown' — Types of workflow steps
        - `iterate_over` string, required — Variable name containing array to iterate over (e.g., 'product_links')
        - `item_name` string — Variable name for current item in loop (e.g., 'current_link')
        - `index_name` string — Variable name for current index (e.g., 'i')
        - `steps` union[], required — Steps to execute for each item
          - union
            - NavigationStep — Navigate to a URL
              - …
            - ActionStep — Perform an action on the page
              - …
            - ExtractionStep — Extract data from the page
              - …
            - MarkdownExtractionStep — Extract markdown from the page
              - …
            - LoopStep — recursive
            - ConditionalStep — Conditional execution (if/else)
              - …
            - SubWorkflowStep — Execute a subworkflow
              - …
            - WaitStep — Wait for a condition or time
              - …
        - `max_iterations` integer, nullable — Maximum number of iterations (safety limit)
      - ConditionalStep — Conditional execution (if/else)
        - `type` 'navigate' | 'action' | 'extract' | 'loop' | 'conditional' | 'subworkflow' | 'wait' | 'extract_markdown' — Types of workflow steps
        - `condition` string, required — Condition to evaluate (e.g., '{{index}} < 10', '{{item}} != null')
        - `if_steps` union[], required — Steps to execute if condition is true
          - union
            - NavigationStep — Navigate to a URL
              - …
            - ActionStep — Perform an action on the page
              - …
            - ExtractionStep — Extract data from the page
              - …
            - MarkdownExtractionStep — Extract markdown from the page
              - …
            - LoopStep — Iterate over an array
              - …
            - ConditionalStep — recursive
            - SubWorkflowStep — Execute a subworkflow
              - …
            - WaitStep — Wait for a condition or time
              - …
        - `else_steps` union[], nullable — Steps to execute if condition is false
          - union
            - NavigationStep — Navigate to a URL
              - …
            - ActionStep — Perform an action on the page
              - …
            - ExtractionStep — Extract data from the page
              - …
            - MarkdownExtractionStep — Extract markdown from the page
              - …
            - LoopStep — Iterate over an array
              - …
            - ConditionalStep — recursive
            - SubWorkflowStep — Execute a subworkflow
              - …
            - WaitStep — Wait for a condition or time
              - …
      - SubWorkflowStep — Execute a subworkflow
        - `type` 'navigate' | 'action' | 'extract' | 'loop' | 'conditional' | 'subworkflow' | 'wait' | 'extract_markdown' — Types of workflow steps
        - `workflow_id` string, nullable — ID of saved workflow to execute
        - `workflow` WorkflowDefinition — recursive
        - `input_mapping` object — Map parent context variables to subworkflow variables (e.g., {'url': '{{current_link}}'})
        - `output_mapping` object, nullable — Map subworkflow output variables back to parent context
      - WaitStep — Wait for a condition or time
        - `type` 'navigate' | 'action' | 'extract' | 'loop' | 'conditional' | 'subworkflow' | 'wait' | 'extract_markdown' — Types of workflow steps
        - `duration` number, nullable — Seconds to wait
        - `for_selector` string, nullable — CSS selector to wait for
        - `for_condition` string, nullable — JavaScript condition to wait for
  - `initial_context` object — Initial variables/context (e.g., {'email': 'user@example.com', 'password': 'secret'})
  - `output_variables` string[], nullable — List of variables to include in final output

## Response `200`

Successful Response

- WorkflowExecutionResult — Result of workflow execution
  - `request_id` string, required
  - `workflow_id` string, nullable, required
  - `success` boolean, required
  - `steps_executed` StepResult[], required
    - `step_index` integer, required
    - `step_type` 'navigate' | 'action' | 'extract' | 'loop' | 'conditional' | 'subworkflow' | 'wait' | 'extract_markdown', required — Types of workflow steps
    - `success` boolean, required
    - `error` string, nullable
    - `data` object, nullable
    - `duration_seconds` number, required
  - `total_duration_seconds` number, required
  - `final_context` object — Final workflow context with all variables
  - `output` object — Filtered output based on output_variables
  - `final_url` string, nullable
  - `final_html` string, nullable
  - `session_id` string, nullable
  - `error` string, nullable

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/scrapegraphai/apis/fastapi.md) · [All operations](https://skmtc.dev/scrapegraphai/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/scrapegraphai/fastapi/revisions/7583b63abb6e/schema)
