optexity 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. {optexity-0.1.2 → optexity-0.1.4}/PKG-INFO +20 -36
  2. {optexity-0.1.2 → optexity-0.1.4}/README.md +19 -35
  3. {optexity-0.1.2 → optexity-0.1.4}/optexity/cli.py +1 -1
  4. optexity-0.1.4/optexity/examples/__init__.py +0 -0
  5. optexity-0.1.4/optexity/examples/add_example.py +88 -0
  6. optexity-0.1.4/optexity/examples/download_pdf_url.py +29 -0
  7. optexity-0.1.4/optexity/examples/extract_price_stockanalysis.py +44 -0
  8. optexity-0.1.4/optexity/examples/file_upload.py +59 -0
  9. optexity-0.1.4/optexity/examples/i94.py +126 -0
  10. optexity-0.1.4/optexity/examples/i94_travel_history.py +126 -0
  11. optexity-0.1.4/optexity/examples/peachstate_medicaid.py +201 -0
  12. optexity-0.1.4/optexity/examples/supabase_login.py +75 -0
  13. optexity-0.1.4/optexity/inference/__init__.py +0 -0
  14. optexity-0.1.4/optexity/inference/agents/__init__.py +0 -0
  15. optexity-0.1.4/optexity/inference/agents/error_handler/__init__.py +0 -0
  16. optexity-0.1.4/optexity/inference/agents/error_handler/error_handler.py +39 -0
  17. optexity-0.1.4/optexity/inference/agents/error_handler/prompt.py +60 -0
  18. optexity-0.1.4/optexity/inference/agents/index_prediction/__init__.py +0 -0
  19. optexity-0.1.4/optexity/inference/agents/index_prediction/action_prediction_locator_axtree.py +45 -0
  20. optexity-0.1.4/optexity/inference/agents/index_prediction/prompt.py +14 -0
  21. optexity-0.1.4/optexity/inference/agents/select_value_prediction/__init__.py +0 -0
  22. optexity-0.1.4/optexity/inference/agents/select_value_prediction/prompt.py +20 -0
  23. optexity-0.1.4/optexity/inference/agents/select_value_prediction/select_value_prediction.py +39 -0
  24. optexity-0.1.4/optexity/inference/agents/two_fa_extraction/__init__.py +0 -0
  25. optexity-0.1.4/optexity/inference/agents/two_fa_extraction/prompt.py +23 -0
  26. optexity-0.1.4/optexity/inference/agents/two_fa_extraction/two_fa_extraction.py +47 -0
  27. optexity-0.1.4/optexity/inference/child_process.py +251 -0
  28. optexity-0.1.4/optexity/inference/core/__init__.py +0 -0
  29. optexity-0.1.4/optexity/inference/core/interaction/__init__.py +0 -0
  30. optexity-0.1.4/optexity/inference/core/interaction/handle_agentic_task.py +79 -0
  31. optexity-0.1.4/optexity/inference/core/interaction/handle_check.py +57 -0
  32. optexity-0.1.4/optexity/inference/core/interaction/handle_click.py +79 -0
  33. optexity-0.1.4/optexity/inference/core/interaction/handle_command.py +261 -0
  34. optexity-0.1.4/optexity/inference/core/interaction/handle_input.py +76 -0
  35. optexity-0.1.4/optexity/inference/core/interaction/handle_keypress.py +16 -0
  36. optexity-0.1.4/optexity/inference/core/interaction/handle_select.py +109 -0
  37. optexity-0.1.4/optexity/inference/core/interaction/handle_select_utils.py +132 -0
  38. optexity-0.1.4/optexity/inference/core/interaction/handle_upload.py +59 -0
  39. optexity-0.1.4/optexity/inference/core/interaction/utils.py +81 -0
  40. optexity-0.1.4/optexity/inference/core/logging.py +406 -0
  41. optexity-0.1.4/optexity/inference/core/run_assertion.py +55 -0
  42. optexity-0.1.4/optexity/inference/core/run_automation.py +463 -0
  43. optexity-0.1.4/optexity/inference/core/run_extraction.py +240 -0
  44. optexity-0.1.4/optexity/inference/core/run_interaction.py +254 -0
  45. optexity-0.1.4/optexity/inference/core/run_python_script.py +20 -0
  46. optexity-0.1.4/optexity/inference/core/run_two_fa.py +120 -0
  47. optexity-0.1.4/optexity/inference/core/two_factor_auth/__init__.py +0 -0
  48. optexity-0.1.4/optexity/inference/infra/__init__.py +0 -0
  49. optexity-0.1.4/optexity/inference/infra/browser.py +455 -0
  50. optexity-0.1.4/optexity/inference/infra/browser_extension.py +20 -0
  51. optexity-0.1.4/optexity/inference/models/__init__.py +22 -0
  52. optexity-0.1.4/optexity/inference/models/gemini.py +113 -0
  53. optexity-0.1.4/optexity/inference/models/human.py +20 -0
  54. optexity-0.1.4/optexity/inference/models/llm_model.py +210 -0
  55. optexity-0.1.4/optexity/inference/run_local.py +200 -0
  56. optexity-0.1.4/optexity/schema/__init__.py +0 -0
  57. optexity-0.1.4/optexity/schema/actions/__init__.py +0 -0
  58. optexity-0.1.4/optexity/schema/actions/assertion_action.py +66 -0
  59. optexity-0.1.4/optexity/schema/actions/extraction_action.py +143 -0
  60. optexity-0.1.4/optexity/schema/actions/interaction_action.py +330 -0
  61. optexity-0.1.4/optexity/schema/actions/misc_action.py +18 -0
  62. optexity-0.1.4/optexity/schema/actions/prompts.py +27 -0
  63. optexity-0.1.4/optexity/schema/actions/two_fa_action.py +24 -0
  64. optexity-0.1.4/optexity/schema/automation.py +432 -0
  65. optexity-0.1.4/optexity/schema/callback.py +16 -0
  66. optexity-0.1.4/optexity/schema/inference.py +87 -0
  67. optexity-0.1.4/optexity/schema/memory.py +100 -0
  68. optexity-0.1.4/optexity/schema/task.py +212 -0
  69. optexity-0.1.4/optexity/schema/token_usage.py +48 -0
  70. optexity-0.1.4/optexity/utils/__init__.py +0 -0
  71. optexity-0.1.4/optexity/utils/settings.py +54 -0
  72. optexity-0.1.4/optexity/utils/utils.py +76 -0
  73. {optexity-0.1.2 → optexity-0.1.4}/optexity.egg-info/PKG-INFO +20 -36
  74. optexity-0.1.4/optexity.egg-info/SOURCES.txt +83 -0
  75. {optexity-0.1.2 → optexity-0.1.4}/pyproject.toml +2 -2
  76. optexity-0.1.2/optexity.egg-info/SOURCES.txt +0 -14
  77. {optexity-0.1.2 → optexity-0.1.4}/LICENSE +0 -0
  78. {optexity-0.1.2 → optexity-0.1.4}/optexity/__init__.py +0 -0
  79. {optexity-0.1.2 → optexity-0.1.4}/optexity/exceptions.py +0 -0
  80. {optexity-0.1.2 → optexity-0.1.4}/optexity/onepassword_integration.py +0 -0
  81. {optexity-0.1.2 → optexity-0.1.4}/optexity/test.py +0 -0
  82. {optexity-0.1.2 → optexity-0.1.4}/optexity.egg-info/dependency_links.txt +0 -0
  83. {optexity-0.1.2 → optexity-0.1.4}/optexity.egg-info/entry_points.txt +0 -0
  84. {optexity-0.1.2 → optexity-0.1.4}/optexity.egg-info/requires.txt +0 -0
  85. {optexity-0.1.2 → optexity-0.1.4}/optexity.egg-info/top_level.txt +0 -0
  86. {optexity-0.1.2 → optexity-0.1.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: optexity
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Optexity is a platform for building and running browser and computer agents.
5
5
  Author-email: Optexity <support@optexity.com>
6
6
  Requires-Python: >=3.11
@@ -50,30 +50,19 @@ Once logged in, navigate to the **API Keys** section in your dashboard and creat
50
50
 
51
51
  Install the **Optexity Recorder** extension from the [Chrome Web Store](https://chromewebstore.google.com/detail/optexity-recorder/pbaganbicadeoacahamnbgohafchgakp). This extension captures your browser interactions and converts them into automation workflows.
52
52
 
53
- ## Installation
54
-
55
53
  ### Prerequisites
56
54
 
57
55
  - Python 3.11+
58
- - Node.js 18+ (included with Conda option)
59
56
  - Git
60
57
 
61
- ### Step 1: Clone the Repository
62
-
63
- ```bash
64
- git clone git@github.com:Optexity/optexity.git
65
- cd optexity
66
- ./update_submodule.sh
67
- ```
68
-
69
- ### Step 2: Create and Activate a Python Environment
58
+ ## Create and Activate a Python Environment (Optional)
70
59
 
71
60
  Choose **one** of the options below.
72
61
 
73
62
  #### Option A – Conda (includes Python 3.11 and Node.js)
74
63
 
75
64
  ```bash
76
- conda create -n optexity python=3.11 nodejs
65
+ conda create -n optexity python=3.11
77
66
  conda activate optexity
78
67
  ```
79
68
 
@@ -86,32 +75,29 @@ python3 -m venv .venv
86
75
  source .venv/bin/activate
87
76
  ```
88
77
 
89
- > If you pick `venv`, ensure Node.js 18+ is already available on your machine before continuing.
78
+ ## Installation
90
79
 
91
- ### Step 3: Install Dependencies
80
+ ### Quick Installation (from PyPI)
92
81
 
93
- Run everything from the repository root:
82
+ Install Optexity directly from PyPI:
94
83
 
95
84
  ```bash
96
- pip install -e "external/browser-use"
97
- pip install -e .
98
- playwright install --with-deps chromium chrome
99
- patchright install chromium chrome
100
- pre-commit install --install-hooks
101
- pre-commit install --hook-type pre-push
85
+ pip install optexity
102
86
  ```
87
+ **OR**
103
88
 
104
- ### Step 4: Configure Your Environment
89
+ ### Installation from Source
105
90
 
106
- Optexity reads configuration from a standard `.env` file via the `ENV_PATH` environment variable.
91
+ If you want to clone and edit from source:
107
92
 
108
- Create a `.env` file in the repo root:
109
93
 
110
94
  ```bash
111
- touch .env
95
+ git clone git@github.com:Optexity/optexity.git
96
+ cd optexity
97
+ pip install -e .
112
98
  ```
113
99
 
114
- Add the required values:
100
+ ## Set required environment variables:
115
101
 
116
102
  ```bash
117
103
  API_KEY=YOUR_OPTEXITY_API_KEY # API key used for authenticated requests
@@ -121,14 +107,14 @@ DEPLOYMENT=dev # or "prod" in production
121
107
 
122
108
  You can get your free Google Gemini API key from the [Google AI Studio Console](https://aistudio.google.com).
123
109
 
124
- Then export `ENV_PATH` when running processes that rely on these settings:
110
+ ## Install required browsers:
111
+
112
+ Install playwright and patchright browsers:
125
113
 
126
114
  ```bash
127
- export ENV_PATH=.env
115
+ optexity install-browsers
128
116
  ```
129
117
 
130
- > If `ENV_PATH` is not set, the inference server will try to start with defaults and log a warning. For normal usage you should always point `ENV_PATH` at a real `.env` file.
131
-
132
118
  ## Recording Your First Automation
133
119
 
134
120
  The fastest way to create an automation is by recording your actions directly in the browser.
@@ -156,12 +142,10 @@ The fastest way to create an automation is by recording your actions directly in
156
142
 
157
143
  ### Start the Inference Server
158
144
 
159
- The primary way to run browser automations locally is via the inference child process server.
160
-
161
- From the repository root:
145
+ The primary way to run browser automations locally is via the inference server.
162
146
 
163
147
  ```bash
164
- ENV_PATH=.env python optexity/inference/child_process.py --port 9000 --child_process_id 0
148
+ optexity inference --port 9000 --child_process_id 0
165
149
  ```
166
150
 
167
151
  Key parameters:
@@ -25,30 +25,19 @@ Once logged in, navigate to the **API Keys** section in your dashboard and creat
25
25
 
26
26
  Install the **Optexity Recorder** extension from the [Chrome Web Store](https://chromewebstore.google.com/detail/optexity-recorder/pbaganbicadeoacahamnbgohafchgakp). This extension captures your browser interactions and converts them into automation workflows.
27
27
 
28
- ## Installation
29
-
30
28
  ### Prerequisites
31
29
 
32
30
  - Python 3.11+
33
- - Node.js 18+ (included with Conda option)
34
31
  - Git
35
32
 
36
- ### Step 1: Clone the Repository
37
-
38
- ```bash
39
- git clone git@github.com:Optexity/optexity.git
40
- cd optexity
41
- ./update_submodule.sh
42
- ```
43
-
44
- ### Step 2: Create and Activate a Python Environment
33
+ ## Create and Activate a Python Environment (Optional)
45
34
 
46
35
  Choose **one** of the options below.
47
36
 
48
37
  #### Option A – Conda (includes Python 3.11 and Node.js)
49
38
 
50
39
  ```bash
51
- conda create -n optexity python=3.11 nodejs
40
+ conda create -n optexity python=3.11
52
41
  conda activate optexity
53
42
  ```
54
43
 
@@ -61,32 +50,29 @@ python3 -m venv .venv
61
50
  source .venv/bin/activate
62
51
  ```
63
52
 
64
- > If you pick `venv`, ensure Node.js 18+ is already available on your machine before continuing.
53
+ ## Installation
65
54
 
66
- ### Step 3: Install Dependencies
55
+ ### Quick Installation (from PyPI)
67
56
 
68
- Run everything from the repository root:
57
+ Install Optexity directly from PyPI:
69
58
 
70
59
  ```bash
71
- pip install -e "external/browser-use"
72
- pip install -e .
73
- playwright install --with-deps chromium chrome
74
- patchright install chromium chrome
75
- pre-commit install --install-hooks
76
- pre-commit install --hook-type pre-push
60
+ pip install optexity
77
61
  ```
62
+ **OR**
78
63
 
79
- ### Step 4: Configure Your Environment
64
+ ### Installation from Source
80
65
 
81
- Optexity reads configuration from a standard `.env` file via the `ENV_PATH` environment variable.
66
+ If you want to clone and edit from source:
82
67
 
83
- Create a `.env` file in the repo root:
84
68
 
85
69
  ```bash
86
- touch .env
70
+ git clone git@github.com:Optexity/optexity.git
71
+ cd optexity
72
+ pip install -e .
87
73
  ```
88
74
 
89
- Add the required values:
75
+ ## Set required environment variables:
90
76
 
91
77
  ```bash
92
78
  API_KEY=YOUR_OPTEXITY_API_KEY # API key used for authenticated requests
@@ -96,14 +82,14 @@ DEPLOYMENT=dev # or "prod" in production
96
82
 
97
83
  You can get your free Google Gemini API key from the [Google AI Studio Console](https://aistudio.google.com).
98
84
 
99
- Then export `ENV_PATH` when running processes that rely on these settings:
85
+ ## Install required browsers:
86
+
87
+ Install playwright and patchright browsers:
100
88
 
101
89
  ```bash
102
- export ENV_PATH=.env
90
+ optexity install-browsers
103
91
  ```
104
92
 
105
- > If `ENV_PATH` is not set, the inference server will try to start with defaults and log a warning. For normal usage you should always point `ENV_PATH` at a real `.env` file.
106
-
107
93
  ## Recording Your First Automation
108
94
 
109
95
  The fastest way to create an automation is by recording your actions directly in the browser.
@@ -131,12 +117,10 @@ The fastest way to create an automation is by recording your actions directly in
131
117
 
132
118
  ### Start the Inference Server
133
119
 
134
- The primary way to run browser automations locally is via the inference child process server.
135
-
136
- From the repository root:
120
+ The primary way to run browser automations locally is via the inference server.
137
121
 
138
122
  ```bash
139
- ENV_PATH=.env python optexity/inference/child_process.py --port 9000 --child_process_id 0
123
+ optexity inference --port 9000 --child_process_id 0
140
124
  ```
141
125
 
142
126
  Key parameters:
@@ -64,7 +64,7 @@ def main() -> None:
64
64
  "inference", help="Run Optexity inference server"
65
65
  )
66
66
  inference_cmd.add_argument("--host", default="0.0.0.0")
67
- inference_cmd.add_argument("--port", type=int, required=True)
67
+ inference_cmd.add_argument("--port", type=int, default=9000)
68
68
  inference_cmd.add_argument(
69
69
  "--child_process_id", "--child-process-id", type=int, default=0
70
70
  )
File without changes
@@ -0,0 +1,88 @@
1
+ import argparse
2
+ import logging
3
+ from urllib.parse import urljoin
4
+
5
+ import httpx
6
+
7
+ from optexity.examples import (
8
+ download_pdf_url,
9
+ file_upload,
10
+ i94,
11
+ i94_travel_history,
12
+ peachstate_medicaid,
13
+ supabase_login,
14
+ )
15
+ from optexity.utils.settings import Settings
16
+
17
+ logger = logging.getLogger(__name__)
18
+ settings = Settings()
19
+
20
+ logger.setLevel(logging.INFO)
21
+
22
+
23
+ def main(args):
24
+ if args.example == "i94":
25
+ example = i94
26
+ elif args.example == "i94_travel_history":
27
+ example = i94_travel_history
28
+ elif args.example == "peachstate_medicaid":
29
+ example = peachstate_medicaid
30
+ elif args.example == "supabase_login":
31
+ example = supabase_login
32
+ elif args.example == "download_pdf_url":
33
+ example = download_pdf_url
34
+ elif args.example == "file_upload":
35
+ example = file_upload
36
+ else:
37
+ raise ValueError(f"Invalid example: {args.example}")
38
+ try:
39
+ logger.info(f"➕ Adding example: {args.example}")
40
+ headers = {"x-api-key": settings.API_KEY}
41
+ with httpx.Client() as client:
42
+ response = client.post(
43
+ urljoin(
44
+ settings.SERVER_URL,
45
+ (
46
+ settings.ADD_EXAMPLE_ENDPOINT
47
+ if not args.update
48
+ else settings.UPDATE_EXAMPLE_ENDPOINT
49
+ ),
50
+ ),
51
+ headers=headers,
52
+ json={
53
+ "automation": example.automation.model_dump(
54
+ exclude_none=True, exclude_defaults=True
55
+ ),
56
+ "description": example.description,
57
+ "endpoint_name": example.endpoint_name,
58
+ },
59
+ )
60
+ response.raise_for_status()
61
+ logger.info(f"✓ Example added successfully: {response.json()}")
62
+ except Exception as e:
63
+ logger.error(f"❌ Error adding example: {response.json()}")
64
+
65
+
66
+ if __name__ == "__main__":
67
+ parser = argparse.ArgumentParser()
68
+ parser.add_argument(
69
+ "--example",
70
+ type=str,
71
+ choices=[
72
+ "i94",
73
+ "i94_travel_history",
74
+ "peachstate_medicaid",
75
+ "supabase_login",
76
+ "download_pdf_url",
77
+ "file_upload",
78
+ ],
79
+ required=True,
80
+ )
81
+ parser.add_argument(
82
+ "--update",
83
+ action="store_true",
84
+ default=False,
85
+ )
86
+ args = parser.parse_args()
87
+
88
+ main(args)
@@ -0,0 +1,29 @@
1
+ from optexity.schema.automation import Automation
2
+
3
+ description = "Download PDF URL Example"
4
+ endpoint_name = "download_pdf_url"
5
+ automation_json = {
6
+ "url": "about:blank",
7
+ "parameters": {
8
+ "input_parameters": {
9
+ "pdf_url": ["https://s24.q4cdn.com/216390268/files/doc_downloads/test.pdf"]
10
+ },
11
+ "generated_parameters": {},
12
+ },
13
+ "nodes": [
14
+ {
15
+ "type": "action_node",
16
+ "interaction_action": {"go_to_url": {"url": "{pdf_url[0]}"}},
17
+ "end_sleep_time": 1.0,
18
+ },
19
+ {
20
+ "type": "action_node",
21
+ "interaction_action": {
22
+ "download_url_as_pdf": {"download_filename": "example.pdf"}
23
+ },
24
+ "end_sleep_time": 1.0,
25
+ },
26
+ ],
27
+ }
28
+
29
+ automation = Automation.model_validate(automation_json)
@@ -0,0 +1,44 @@
1
+ from optexity.schema.automation import Automation
2
+
3
+ description = "Extract stock price from StockAnalysis"
4
+ endpoint_name = "extract_price_stockanalysis"
5
+ automation_json = {
6
+ "url": "https://stockanalysis.com/",
7
+ "parameters": {
8
+ "input_parameters": {"stock_ticker": ["AAPL"]},
9
+ "generated_parameters": {},
10
+ },
11
+ "nodes": [
12
+ {
13
+ "interaction_action": {
14
+ "input_text": {
15
+ "command": 'locator("#search-header")',
16
+ "prompt_instructions": "Fill the input field with ID 'search-header' with the value of the 'stock_ticker' variable.",
17
+ "input_text": "{stock_ticker[0]}",
18
+ }
19
+ }
20
+ },
21
+ {
22
+ "interaction_action": {
23
+ "click_element": {
24
+ "prompt_instructions": "Click on the link with the name of the stock equivalent for {stock_ticker[0]}."
25
+ }
26
+ }
27
+ },
28
+ {
29
+ "extraction_action": {
30
+ "llm": {
31
+ "source": ["screenshot"],
32
+ "extraction_format": {
33
+ "stock_name": "str",
34
+ "stock_price": "str",
35
+ "stock_symbol": "str",
36
+ },
37
+ "extraction_instructions": "Extract the stock price, stock name, and stock symbol from the webpage.",
38
+ }
39
+ }
40
+ },
41
+ ],
42
+ }
43
+
44
+ automation = Automation.model_validate(automation_json)
@@ -0,0 +1,59 @@
1
+ from optexity.schema.automation import Automation
2
+
3
+ description = "File Upload Example"
4
+ endpoint_name = "file_upload"
5
+ automation_json = {
6
+ "url": "https://www.azurespeed.com/Azure/UploadLargeFile",
7
+ "parameters": {
8
+ "input_parameters": {
9
+ "target_region_option": ["test_region"],
10
+ "file_path": ["/path/to/test/file.txt"],
11
+ },
12
+ "generated_parameters": {},
13
+ },
14
+ "nodes": [
15
+ {
16
+ "type": "action_node",
17
+ "interaction_action": {
18
+ "select_option": {
19
+ "command": 'get_by_label("Target region")',
20
+ "prompt_instructions": "Select an option from the field labeled 'Target region' with the value from the 'target_region_option' variable.",
21
+ "select_values": ["{target_region_option[0]}"],
22
+ }
23
+ },
24
+ "end_sleep_time": 1.0,
25
+ },
26
+ {
27
+ "type": "action_node",
28
+ "interaction_action": {
29
+ "upload_file": {
30
+ "command": 'get_by_role("button", name="Test file")',
31
+ "prompt_instructions": "Click on the 'Test file' button.",
32
+ "file_path": "{file_path[0]}",
33
+ }
34
+ },
35
+ "end_sleep_time": 1.0,
36
+ },
37
+ {
38
+ "type": "action_node",
39
+ "interaction_action": {
40
+ "click_element": {
41
+ "command": 'get_by_role("button", name="Start test")',
42
+ "prompt_instructions": "Click the 'Start test' button",
43
+ }
44
+ },
45
+ "end_sleep_time": 1.0,
46
+ },
47
+ {
48
+ "type": "action_node",
49
+ "assertion_action": {
50
+ "llm": {
51
+ "extraction_instructions": "Check if the file upload was successful"
52
+ }
53
+ },
54
+ "before_sleep_time": 10.0,
55
+ "end_sleep_time": 0.0,
56
+ },
57
+ ],
58
+ }
59
+ automation = Automation.model_validate(automation_json)
@@ -0,0 +1,126 @@
1
+ from optexity.schema.automation import Automation
2
+
3
+ description = "I94 Example"
4
+ endpoint_name = "i94"
5
+ automation_json = {
6
+ "url": "https://i94.cbp.dhs.gov/search/recent-search",
7
+ "nodes": [
8
+ {
9
+ "type": "action_node",
10
+ "end_sleep_time": 1,
11
+ "before_sleep_time": 3,
12
+ "python_script_action": {
13
+ "execution_code": 'async def code_fn(page):\n print("entering code_fn")\n await page.evaluate(\n """ const el = document.querySelector(\'mat-dialog-content\'); if (el) el.scrollTop = el.scrollHeight;"""\n )\n print("exiting code_fn")\n'
14
+ },
15
+ },
16
+ {
17
+ "type": "action_node",
18
+ "end_sleep_time": 1,
19
+ "interaction_action": {
20
+ "click_element": {
21
+ "command": 'get_by_role("button", name="I ACKNOWLEDGE AND AGREE")',
22
+ "prompt_instructions": "Click the I ACKNOWLEDGE AND AGREE button",
23
+ }
24
+ },
25
+ },
26
+ {
27
+ "type": "action_node",
28
+ "end_sleep_time": 1,
29
+ "interaction_action": {
30
+ "input_text": {
31
+ "command": 'get_by_role("textbox", name="Please enter your first name")',
32
+ "input_text": "{first_name[0]}",
33
+ "prompt_instructions": "Enter the First Name",
34
+ }
35
+ },
36
+ },
37
+ {
38
+ "type": "action_node",
39
+ "end_sleep_time": 1,
40
+ "interaction_action": {
41
+ "input_text": {
42
+ "command": 'get_by_role("textbox", name="Please enter your last name")',
43
+ "input_text": "{last_name[0]}",
44
+ "prompt_instructions": "Enter the Last Name",
45
+ }
46
+ },
47
+ },
48
+ {
49
+ "type": "action_node",
50
+ "end_sleep_time": 1,
51
+ "interaction_action": {
52
+ "input_text": {
53
+ "command": 'get_by_role("textbox", name="Date of Birth")',
54
+ "input_text": "{date_of_birth[0]}",
55
+ "prompt_instructions": "Enter the Date of Birth",
56
+ }
57
+ },
58
+ },
59
+ {
60
+ "type": "action_node",
61
+ "end_sleep_time": 1,
62
+ "interaction_action": {
63
+ "input_text": {
64
+ "command": 'get_by_role("textbox", name="Please enter your document")',
65
+ "input_text": "{document_number[0]}",
66
+ "prompt_instructions": "Enter the Document Number",
67
+ }
68
+ },
69
+ },
70
+ {
71
+ "type": "action_node",
72
+ "end_sleep_time": 1,
73
+ "interaction_action": {
74
+ "input_text": {
75
+ "command": 'get_by_role("combobox", name="Please enter your document")',
76
+ "input_text": "{nationality[0]}",
77
+ "prompt_instructions": "Enter the Nationality",
78
+ }
79
+ },
80
+ },
81
+ {
82
+ "type": "action_node",
83
+ "end_sleep_time": 1,
84
+ "interaction_action": {
85
+ "click_element": {
86
+ "prompt_instructions": "Select {nationality[0]} from the options. Be careful to select the correct option. which will be of the format `nationality (code)`"
87
+ }
88
+ },
89
+ },
90
+ {
91
+ "type": "action_node",
92
+ "end_sleep_time": 1,
93
+ "interaction_action": {
94
+ "click_element": {
95
+ "command": 'get_by_role("button", name="Click to submit the form")',
96
+ "prompt_instructions": "Click the Submit button",
97
+ }
98
+ },
99
+ },
100
+ {
101
+ "type": "action_node",
102
+ "end_sleep_time": 0,
103
+ "before_sleep_time": 3,
104
+ "extraction_action": {
105
+ "network_call": {
106
+ "extract_from": "response",
107
+ "url_pattern": "https://i94.cbp.dhs.gov/api/services/i94/recent",
108
+ }
109
+ },
110
+ },
111
+ ],
112
+ "parameters": {
113
+ "input_parameters": {
114
+ "last_name": ["Last Name"],
115
+ "first_name": ["First Name"],
116
+ "nationality": ["IND"],
117
+ "date_of_birth": ["MM/DD/YYYY"],
118
+ "document_number": ["Document Number"],
119
+ },
120
+ "generated_parameters": {},
121
+ },
122
+ "browser_channel": "chrome",
123
+ }
124
+
125
+
126
+ automation = Automation.model_validate(automation_json)