Workflow Copilot: update knowledge base (#4448)
This commit is contained in:
committed by
GitHub
parent
f7970bab32
commit
42af2fd96c
@@ -11,8 +11,8 @@ title: "<workflow title>"
|
|||||||
description: "<optional description>"
|
description: "<optional description>"
|
||||||
workflow_definition:
|
workflow_definition:
|
||||||
version: 2 # IMPORTANT: Always use version 2
|
version: 2 # IMPORTANT: Always use version 2
|
||||||
parameters: []
|
|
||||||
blocks: []
|
blocks: []
|
||||||
|
parameters: []
|
||||||
webhook_callback_url: "<optional_https_url>" # Optional: Webhook URL to receive workflow run updates
|
webhook_callback_url: "<optional_https_url>" # Optional: Webhook URL to receive workflow run updates
|
||||||
|
|
||||||
Key Concepts:
|
Key Concepts:
|
||||||
@@ -34,13 +34,18 @@ workflow_parameter_type: <string|integer|float|boolean|json|file_url|credential_
|
|||||||
description: <optional description>
|
description: <optional description>
|
||||||
default_value: <optional default>
|
default_value: <optional default>
|
||||||
|
|
||||||
|
Define exactly one parameters list under workflow_definition.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
parameters:
|
workflow_definition:
|
||||||
- parameter_type: workflow
|
version: 2
|
||||||
key: search_query
|
blocks: []
|
||||||
workflow_parameter_type: string
|
parameters:
|
||||||
description: "Search term to use"
|
- parameter_type: workflow
|
||||||
default_value: "example"
|
key: search_query
|
||||||
|
workflow_parameter_type: string
|
||||||
|
description: "Search term to use"
|
||||||
|
default_value: "example"
|
||||||
|
|
||||||
* OUTPUT PARAMETERS (block outputs)
|
* OUTPUT PARAMETERS (block outputs)
|
||||||
parameter_type: output
|
parameter_type: output
|
||||||
@@ -61,18 +66,18 @@ Using Parameters in Blocks:
|
|||||||
Example:
|
Example:
|
||||||
workflow_definition:
|
workflow_definition:
|
||||||
version: 2
|
version: 2
|
||||||
parameters:
|
|
||||||
- key: topics_count
|
|
||||||
description: null
|
|
||||||
parameter_type: workflow
|
|
||||||
workflow_parameter_type: integer
|
|
||||||
default_value: "3"
|
|
||||||
blocks:
|
blocks:
|
||||||
- label: block_1
|
- label: block_1
|
||||||
block_type: task_v2
|
block_type: task_v2
|
||||||
prompt: Give me top {{topics_count}} news items
|
prompt: Give me top {{topics_count}} news items
|
||||||
url: https://news.ycombinator.com/
|
url: https://news.ycombinator.com/
|
||||||
next_block_label: null
|
next_block_label: null
|
||||||
|
parameters:
|
||||||
|
- key: topics_count
|
||||||
|
description: null
|
||||||
|
parameter_type: workflow
|
||||||
|
workflow_parameter_type: integer
|
||||||
|
default_value: "3"
|
||||||
|
|
||||||
** COMMON BLOCK FIELDS **
|
** COMMON BLOCK FIELDS **
|
||||||
|
|
||||||
@@ -123,15 +128,21 @@ Use Cases:
|
|||||||
- Execute focused browser tasks with clear completion criteria
|
- Execute focused browser tasks with clear completion criteria
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
blocks:
|
workflow_definition:
|
||||||
- block_type: navigation
|
version: 2
|
||||||
label: search_and_open
|
blocks:
|
||||||
next_block_label: null
|
- block_type: navigation
|
||||||
url: "https://example.com/search"
|
label: search_and_open
|
||||||
navigation_goal: "Search for {{ query }} and click the first result"
|
next_block_label: null
|
||||||
parameter_keys:
|
url: "https://example.com/search"
|
||||||
- query
|
navigation_goal: "Search for {{ query }} and click the first result"
|
||||||
max_retries: 2
|
parameter_keys:
|
||||||
|
- query
|
||||||
|
max_retries: 2
|
||||||
|
parameters:
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: query
|
||||||
|
workflow_parameter_type: string
|
||||||
|
|
||||||
** URL BLOCK (goto_url) **
|
** URL BLOCK (goto_url) **
|
||||||
|
|
||||||
@@ -222,6 +233,82 @@ blocks:
|
|||||||
prompt: "Book a flight from {{ origin }} to {{ destination }} on {{ date }}. Return the booking confirmation number."
|
prompt: "Book a flight from {{ origin }} to {{ destination }} on {{ date }}. Return the booking confirmation number."
|
||||||
max_iterations: 10
|
max_iterations: 10
|
||||||
|
|
||||||
|
** FOR LOOP BLOCK (for_loop) **
|
||||||
|
|
||||||
|
Purpose: Iterate over a list of values and run a sequence of blocks for each item.
|
||||||
|
|
||||||
|
Structure:
|
||||||
|
block_type: for_loop
|
||||||
|
label: <unique_label>
|
||||||
|
loop_blocks: [] # Required: Blocks to run for each iteration
|
||||||
|
loop_over_parameter_key: <param_key> # Optional: Parameter key that resolves to a list
|
||||||
|
loop_variable_reference: <jinja|path> # Optional: Jinja2 or output path to resolve a list
|
||||||
|
complete_if_empty: false # Optional: Complete successfully when list is empty
|
||||||
|
|
||||||
|
Important Notes:
|
||||||
|
- Provide either loop_over_parameter_key or loop_variable_reference
|
||||||
|
- Loop blocks must use next_block_label to chain within the loop
|
||||||
|
- Each iteration exposes {{ current_value }}, {{ current_item }}, and {{ current_index }}
|
||||||
|
|
||||||
|
Example:
|
||||||
|
parameters:
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: urls
|
||||||
|
workflow_parameter_type: json
|
||||||
|
default_value:
|
||||||
|
- "https://example.com/a"
|
||||||
|
- "https://example.com/b"
|
||||||
|
blocks:
|
||||||
|
- block_type: for_loop
|
||||||
|
label: visit_urls
|
||||||
|
next_block_label: null
|
||||||
|
loop_over_parameter_key: urls
|
||||||
|
loop_blocks:
|
||||||
|
- block_type: goto_url
|
||||||
|
label: open_url
|
||||||
|
next_block_label: null
|
||||||
|
url: "{{ current_value }}"
|
||||||
|
|
||||||
|
** CONDITIONAL BLOCK (conditional) **
|
||||||
|
|
||||||
|
Purpose: Branch to different blocks based on ordered conditions.
|
||||||
|
|
||||||
|
Structure:
|
||||||
|
block_type: conditional
|
||||||
|
label: <unique_label>
|
||||||
|
branch_conditions: [] # Required: Ordered list of branch conditions
|
||||||
|
|
||||||
|
Branch Condition Structure:
|
||||||
|
criteria: # Optional for default branch
|
||||||
|
criteria_type: <jinja2_template|prompt> # Optional: inferred when omitted
|
||||||
|
expression: <expression> # Required when criteria present
|
||||||
|
description: <optional description>
|
||||||
|
next_block_label: <label|null> # Optional: Label to execute when matched
|
||||||
|
description: <optional description>
|
||||||
|
is_default: false # Required when criteria is omitted
|
||||||
|
|
||||||
|
Important Notes:
|
||||||
|
- At least one branch is required
|
||||||
|
- Branches are evaluated in order; first match wins
|
||||||
|
- Only one default branch is allowed
|
||||||
|
- Branches without criteria must set is_default: true
|
||||||
|
|
||||||
|
Example:
|
||||||
|
blocks:
|
||||||
|
- block_type: conditional
|
||||||
|
label: route_by_status
|
||||||
|
next_block_label: null
|
||||||
|
branch_conditions:
|
||||||
|
- criteria:
|
||||||
|
criteria_type: jinja2_template
|
||||||
|
expression: "{{ account_status == 'active' }}"
|
||||||
|
next_block_label: handle_active
|
||||||
|
description: "Active accounts"
|
||||||
|
is_default: false
|
||||||
|
- is_default: true
|
||||||
|
next_block_label: handle_inactive
|
||||||
|
description: "Fallback for all other states"
|
||||||
|
|
||||||
** LOGIN BLOCK (login) **
|
** LOGIN BLOCK (login) **
|
||||||
|
|
||||||
Purpose: Handle authentication flows including username/password and TOTP/2FA.
|
Purpose: Handle authentication flows including username/password and TOTP/2FA.
|
||||||
@@ -251,20 +338,22 @@ Important Notes:
|
|||||||
- TOTP is automatically handled if the credential parameter has TOTP configured
|
- TOTP is automatically handled if the credential parameter has TOTP configured
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
parameters:
|
workflow_definition:
|
||||||
- parameter_type: workflow
|
version: 2
|
||||||
workflow_parameter_type: credential_id
|
blocks:
|
||||||
key: my_credentials
|
- block_type: login
|
||||||
default_value: "cred_uuid_here"
|
label: login_to_portal
|
||||||
blocks:
|
next_block_label: null
|
||||||
- block_type: login
|
url: "https://portal.example.com/login"
|
||||||
label: login_to_portal
|
parameter_keys:
|
||||||
next_block_label: null
|
- my_credentials # This must match a 'key' from the parameters list above
|
||||||
url: "https://portal.example.com/login"
|
complete_criterion: "Current URL is 'https://portal.example.com/dashboard'"
|
||||||
parameter_keys:
|
max_retries: 2
|
||||||
- my_credentials # This must match a 'key' from the parameters list above
|
parameters:
|
||||||
complete_criterion: "Current URL is 'https://portal.example.com/dashboard'"
|
- parameter_type: workflow
|
||||||
max_retries: 2
|
workflow_parameter_type: credential_id
|
||||||
|
key: my_credentials
|
||||||
|
default_value: "cred_uuid_here"
|
||||||
|
|
||||||
** VALIDATION BLOCK (validation) **
|
** VALIDATION BLOCK (validation) **
|
||||||
|
|
||||||
@@ -292,6 +381,22 @@ blocks:
|
|||||||
complete_criterion: "Page contains 'Thank you for your submission'"
|
complete_criterion: "Page contains 'Thank you for your submission'"
|
||||||
terminate_criterion: "Page contains 'Error' or 'Try again'"
|
terminate_criterion: "Page contains 'Error' or 'Try again'"
|
||||||
|
|
||||||
|
** WAIT BLOCK (wait) **
|
||||||
|
|
||||||
|
Purpose: Pause workflow execution for a specified duration.
|
||||||
|
|
||||||
|
Structure:
|
||||||
|
block_type: wait
|
||||||
|
label: <unique_label>
|
||||||
|
wait_sec: <seconds> # Required: Number of seconds to wait
|
||||||
|
|
||||||
|
Example:
|
||||||
|
blocks:
|
||||||
|
- block_type: wait
|
||||||
|
label: wait_for_processing
|
||||||
|
next_block_label: check_results
|
||||||
|
wait_sec: 30
|
||||||
|
|
||||||
** EXTRACTION BLOCK (extraction) **
|
** EXTRACTION BLOCK (extraction) **
|
||||||
|
|
||||||
Purpose: Extract structured data from the current page without navigation.
|
Purpose: Extract structured data from the current page without navigation.
|
||||||
@@ -501,17 +606,23 @@ Use Cases:
|
|||||||
- Generate classifications or tags
|
- Generate classifications or tags
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
blocks:
|
workflow_definition:
|
||||||
- block_type: text_prompt
|
version: 2
|
||||||
label: summarize_notes
|
blocks:
|
||||||
next_block_label: null
|
- block_type: text_prompt
|
||||||
prompt: "Summarize these notes: {{ notes }}"
|
label: summarize_notes
|
||||||
json_schema:
|
next_block_label: null
|
||||||
type: object
|
prompt: "Summarize these notes: {{ notes }}"
|
||||||
properties:
|
json_schema:
|
||||||
summary: {type: string}
|
type: object
|
||||||
action_items: {type: array, items: {type: string}}
|
properties:
|
||||||
parameter_keys: [notes]
|
summary: {type: string}
|
||||||
|
action_items: {type: array, items: {type: string}}
|
||||||
|
parameter_keys: [notes]
|
||||||
|
parameters:
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: notes
|
||||||
|
workflow_parameter_type: string
|
||||||
|
|
||||||
** HTTP REQUEST BLOCK (http_request) **
|
** HTTP REQUEST BLOCK (http_request) **
|
||||||
|
|
||||||
@@ -535,17 +646,26 @@ Use Cases:
|
|||||||
- Upload files via multipart requests
|
- Upload files via multipart requests
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
blocks:
|
workflow_definition:
|
||||||
- block_type: http_request
|
version: 2
|
||||||
label: lookup_customer
|
blocks:
|
||||||
next_block_label: null
|
- block_type: http_request
|
||||||
method: "POST"
|
label: lookup_customer
|
||||||
url: "https://api.example.com/customers/search"
|
next_block_label: null
|
||||||
headers:
|
method: "POST"
|
||||||
Authorization: "Bearer {{ api_token }}"
|
url: "https://api.example.com/customers/search"
|
||||||
body:
|
headers:
|
||||||
email: "{{ customer_email }}"
|
Authorization: "Bearer {{ api_token }}"
|
||||||
parameter_keys: [api_token, customer_email]
|
body:
|
||||||
|
email: "{{ customer_email }}"
|
||||||
|
parameter_keys: [api_token, customer_email]
|
||||||
|
parameters:
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: api_token
|
||||||
|
workflow_parameter_type: string
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: customer_email
|
||||||
|
workflow_parameter_type: string
|
||||||
|
|
||||||
** PARAMETER TEMPLATING **
|
** PARAMETER TEMPLATING **
|
||||||
|
|
||||||
@@ -682,82 +802,107 @@ blocks:
|
|||||||
** COMMON PATTERNS **
|
** COMMON PATTERNS **
|
||||||
|
|
||||||
Pattern 1: Login → Navigate → Extract
|
Pattern 1: Login → Navigate → Extract
|
||||||
parameters:
|
workflow_definition:
|
||||||
- parameter_type: workflow
|
version: 2
|
||||||
workflow_parameter_type: credential_id
|
blocks:
|
||||||
key: my_credentials
|
- block_type: login
|
||||||
default_value: "uuid"
|
label: authenticate
|
||||||
- parameter_type: output
|
next_block_label: go_to_reports
|
||||||
key: extracted_data
|
url: "https://app.example.com/login"
|
||||||
blocks:
|
parameter_keys: [my_credentials]
|
||||||
- block_type: login
|
- block_type: navigation
|
||||||
label: authenticate
|
label: go_to_reports
|
||||||
next_block_label: go_to_reports
|
next_block_label: get_report_data
|
||||||
url: "https://app.example.com/login"
|
navigation_goal: "Navigate to Reports section"
|
||||||
parameter_keys: [my_credentials]
|
- block_type: extraction
|
||||||
- block_type: navigation
|
label: get_report_data
|
||||||
label: go_to_reports
|
next_block_label: null
|
||||||
next_block_label: get_report_data
|
data_extraction_goal: "Extract all report entries"
|
||||||
navigation_goal: "Navigate to Reports section"
|
data_schema:
|
||||||
- block_type: extraction
|
type: array
|
||||||
label: get_report_data
|
items: {type: object}
|
||||||
next_block_label: null
|
parameters:
|
||||||
data_extraction_goal: "Extract all report entries"
|
- parameter_type: workflow
|
||||||
data_schema:
|
workflow_parameter_type: credential_id
|
||||||
type: array
|
key: my_credentials
|
||||||
items: {type: object}
|
default_value: "uuid"
|
||||||
|
- parameter_type: output
|
||||||
|
key: extracted_data
|
||||||
|
|
||||||
Pattern 2: Search with Dynamic Input
|
Pattern 2: Search with Dynamic Input
|
||||||
parameters:
|
workflow_definition:
|
||||||
- parameter_type: workflow
|
version: 2
|
||||||
key: search_query
|
blocks:
|
||||||
workflow_parameter_type: string
|
- block_type: task_v2
|
||||||
blocks:
|
label: search_and_extract
|
||||||
- block_type: task_v2
|
next_block_label: null
|
||||||
label: search_and_extract
|
url: "https://example.com"
|
||||||
next_block_label: null
|
prompt: "Search for '{{ search_query }}' and extract the first 10 results with titles and URLs"
|
||||||
url: "https://example.com"
|
parameters:
|
||||||
prompt: "Search for '{{ search_query }}' and extract the first 10 results with titles and URLs"
|
- parameter_type: workflow
|
||||||
|
key: search_query
|
||||||
|
workflow_parameter_type: string
|
||||||
|
|
||||||
Pattern 3: Multi-Step Form Filling
|
Pattern 3: Multi-Step Form Filling
|
||||||
blocks:
|
workflow_definition:
|
||||||
- block_type: goto_url
|
version: 2
|
||||||
label: open_form
|
blocks:
|
||||||
next_block_label: fill_personal_info
|
- block_type: goto_url
|
||||||
url: "https://forms.example.com/application"
|
label: open_form
|
||||||
- block_type: navigation
|
next_block_label: fill_personal_info
|
||||||
label: fill_personal_info
|
url: "https://forms.example.com/application"
|
||||||
next_block_label: fill_address
|
- block_type: navigation
|
||||||
navigation_goal: "Fill in name as {{ name }}, email as {{ email }}"
|
label: fill_personal_info
|
||||||
parameter_keys: [name, email]
|
next_block_label: fill_address
|
||||||
- block_type: navigation
|
navigation_goal: "Fill in name as {{ name }}, email as {{ email }}"
|
||||||
label: fill_address
|
parameter_keys: [name, email]
|
||||||
next_block_label: submit
|
- block_type: navigation
|
||||||
navigation_goal: "Fill in address fields and click Continue"
|
label: fill_address
|
||||||
parameter_keys: [address, city, zip]
|
next_block_label: submit
|
||||||
- block_type: navigation
|
navigation_goal: "Fill in address fields and click Continue"
|
||||||
label: submit
|
parameter_keys: [address, city, zip]
|
||||||
next_block_label: null
|
- block_type: navigation
|
||||||
navigation_goal: "Review information and click Submit"
|
label: submit
|
||||||
|
next_block_label: null
|
||||||
|
navigation_goal: "Review information and click Submit"
|
||||||
|
parameters:
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: name
|
||||||
|
workflow_parameter_type: string
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: email
|
||||||
|
workflow_parameter_type: string
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: address
|
||||||
|
workflow_parameter_type: string
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: city
|
||||||
|
workflow_parameter_type: string
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: zip
|
||||||
|
workflow_parameter_type: string
|
||||||
|
|
||||||
Pattern 4: Conditional Extraction
|
Pattern 4: Conditional Extraction
|
||||||
blocks:
|
workflow_definition:
|
||||||
- block_type: navigation
|
version: 2
|
||||||
label: search_product
|
blocks:
|
||||||
next_block_label: check_availability
|
- block_type: navigation
|
||||||
navigation_goal: "Search for {{ product }}"
|
label: search_product
|
||||||
- block_type: extraction
|
next_block_label: check_availability
|
||||||
label: check_availability
|
navigation_goal: "Search for {{ product }}"
|
||||||
next_block_label: add_to_cart
|
- block_type: extraction
|
||||||
data_extraction_goal: "Check if product is in stock"
|
label: check_availability
|
||||||
data_schema:
|
next_block_label: add_to_cart
|
||||||
type: object
|
data_extraction_goal: "Check if product is in stock"
|
||||||
properties:
|
data_schema:
|
||||||
in_stock: {type: boolean}
|
type: object
|
||||||
- block_type: navigation
|
properties:
|
||||||
label: add_to_cart
|
in_stock: {type: boolean}
|
||||||
next_block_label: null
|
- block_type: navigation
|
||||||
navigation_goal: "If product is in stock, add to cart"
|
label: add_to_cart
|
||||||
|
next_block_label: null
|
||||||
|
navigation_goal: "If product is in stock, add to cart"
|
||||||
|
parameters: []
|
||||||
|
|
||||||
** VALIDATION RULES **
|
** VALIDATION RULES **
|
||||||
|
|
||||||
@@ -787,22 +932,6 @@ title: E-commerce Product Search and Purchase
|
|||||||
description: Search for a product, extract details, and add to cart
|
description: Search for a product, extract details, and add to cart
|
||||||
workflow_definition:
|
workflow_definition:
|
||||||
version: 2
|
version: 2
|
||||||
parameters:
|
|
||||||
- parameter_type: workflow
|
|
||||||
key: product_name
|
|
||||||
workflow_parameter_type: string
|
|
||||||
description: "Product to search for"
|
|
||||||
- parameter_type: workflow
|
|
||||||
key: max_price
|
|
||||||
workflow_parameter_type: float
|
|
||||||
description: "Maximum price willing to pay"
|
|
||||||
- parameter_type: workflow
|
|
||||||
workflow_parameter_type: credential_id
|
|
||||||
key: account_creds
|
|
||||||
default_value: "cred_12345"
|
|
||||||
- parameter_type: output
|
|
||||||
key: product_details
|
|
||||||
description: "Extracted product information"
|
|
||||||
blocks:
|
blocks:
|
||||||
- block_type: login
|
- block_type: login
|
||||||
label: login_to_store
|
label: login_to_store
|
||||||
@@ -839,5 +968,21 @@ workflow_definition:
|
|||||||
next_block_label: null
|
next_block_label: null
|
||||||
prompt: "Click on the first available product and add it to cart"
|
prompt: "Click on the first available product and add it to cart"
|
||||||
max_iterations: 5
|
max_iterations: 5
|
||||||
|
parameters:
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: product_name
|
||||||
|
workflow_parameter_type: string
|
||||||
|
description: "Product to search for"
|
||||||
|
- parameter_type: workflow
|
||||||
|
key: max_price
|
||||||
|
workflow_parameter_type: float
|
||||||
|
description: "Maximum price willing to pay"
|
||||||
|
- parameter_type: workflow
|
||||||
|
workflow_parameter_type: credential_id
|
||||||
|
key: account_creds
|
||||||
|
default_value: "cred_12345"
|
||||||
|
- parameter_type: output
|
||||||
|
key: product_details
|
||||||
|
description: "Extracted product information"
|
||||||
|
|
||||||
END OF KNOWLEDGE BASE
|
END OF KNOWLEDGE BASE
|
||||||
|
|||||||
Reference in New Issue
Block a user