Vision Targets
A vision Target describes your page as settings: where it is, where its browser runs, and the secrets the Driver types. A Target is the page and holds no steps. The Driver's prompt holds every one, the sign-in and the way to the chat included, and Okareo makes each one a turn of the conversation.
- Okareo UI
- Python
-
Go to Targets and click New Target.
-
Switch the type selector to Vision, and fill in the fields in the order the form shows them:
- Name: the name Okareo lists the Target under, such as
Portal. - URL: the page every conversation opens, an http or https address, such as
https://portal.example.com/login. - Sign-out URL (optional): an address Okareo opens when a conversation ends, your site's sign-out, such as
https://portal.example.com/logout. - Max Parallel Requests (optional): how many conversations a Run holds open at once, such as
5. Leave it empty for the default, 10. - Secrets (optional): one row for each value the Driver types, added with Add secret: its Type, its name and its value. Type is Text for a value typed as it is, or Authenticator key for an authenticator app's key. This page has one,
PORTAL_PASS. See Secrets. - Session ID (optional): where your app keeps its own id for a chat, so each conversation carries it. Leave Source at Not set to skip it. See Session ID.
- Name: the name Okareo lists the Target under, such as
-
Click Create. The Target shows under Targets with the type Vision, and its page reads the settings back, the secrets by name only. Pick it on the simulation page with a Driver and a Scenario, as in Running from the UI.
from okareo_vision import BrowserConfig, VisionTarget
portal = VisionTarget(
url="https://portal.example.com/login",
sign_out_url="https://portal.example.com/logout",
browser_config=BrowserConfig(host="hosted", max_parallel=5),
secrets=["PORTAL_PASS"],
)
Pass the Target to run_simulation as Target(name="Portal", target=portal), as in Your First Vision Simulation. The name in Target(name=...) is the one Okareo lists.
The Driver for this page opens its prompt with the steps to the chat. {scenario_input.email} comes from the row, and {secret.PORTAL_PASS} is typed by name:
## Getting to the chat
Fill Email with {scenario_input.email} and Password with {secret.PORTAL_PASS}, then press Log In.
When the page shows Your Account, press Chat with us.
Your first message goes in the box named Type your message; until it shows, press or wait instead.
Settings
| Setting | Default | What it does |
|---|---|---|
url | required | The page every conversation opens, an http or https address. {scenario_input.KEY} in it is filled from the row's input, per conversation. |
browser_config | required: its host | The browser and where it runs, as a BrowserConfig; see BrowserConfig. |
sign_out_url | None | An address Okareo opens when a conversation ends, before it closes the page: your site's sign-out, so a session does not outlive its conversation. It is not a turn, and if it fails the page closes anyway. |
settle_timeout_s | 30.0 | How long a turn may wait for the agent's reply, in seconds. At most 240. |
secrets | None | The secrets the Driver's prompt types, by name; see Secrets. |
fire_events | () | Events fired on the page after it loads, in order; see Page Events. |
session_id | None | Where your app keeps its own id for a chat, as a SessionId; see Session ID. |
Every conversation starts with no cookies or sign-in left from another. On a page with a sign-in, the Driver signs in every conversation.
The Target form in the Okareo app sets url, sign_out_url, secrets and session_id, and browser_config.max_parallel as Max Parallel Requests. Every other setting is set in Python, and an edit in the app keeps it as it is.
Where the Browser Runs
BrowserConfig(host=...) says where the browser runs, and every VisionTarget must name it. Okareo drives the browser either way.
host="hosted" | host="client_relay" | |
|---|---|---|
| The browser | A browser Okareo hosts, a new one for each conversation. | The Chrome on your machine, driven by Okareo through the relay. |
| The page | One the internet can reach. | Any page your machine can reach, such as one on your own network or on your laptop. |
| On your machine | okareo-vision. | okareo-vision, okareo 0.0.163 or newer, and Google Chrome or Chromium. |
| The secrets' values | Sent to Okareo when the Target is registered. Okareo keeps them for its browser to type, and leaves them out of every API answer. | Never leave your machine. The relay types each one where the Driver names it, and Okareo gets the names only. |
| Your process | Registers the Target and waits for the Run. | Registers the Target, waits for the Run, and runs the relay and Chrome until the Run finishes. |
| In the Okareo app | Made with the Target form, and run from the simulation page. | Registered and run from Python only. Its Runs show in the app like any other. |
A third host, "local", is for Okareo's own development; use "hosted" or "client_relay".
Whichever host you pick, the process that starts the Run reaches Okareo over HTTPS and over a WebSocket to wss://connect.ngs.global:443. A firewall must let both out.
On the Relay
The relay runs inside the process that calls run_simulation. Chrome opens when the Run's first conversation starts, and closes when the Run ends.
- Which Chrome. The relay starts the Google Chrome or Chromium installed on your machine. To use another, set
OKAREO_RELAY_CHROMEto its path. - Watching it. Chrome runs without a window by default.
BrowserConfig(host="client_relay", headless=False)shows a window for each conversation. A window needs a display; on a Linux server, run underxvfb-run. - A proxy. Chrome reaches the page directly from your machine, and does not read
HTTPS_PROXY. A page behind a proxy needs it as a flag:browser_args=("--proxy-server=http://proxy.example.com:8080",).
Secrets
A secret is a value the Driver types without seeing it: a password, a fixed code, an authenticator's six digits. The Target lists each one by name, and the Driver's prompt names it as {secret.NAME}, as the whole value of a field:
Fill Password with {secret.PORTAL_PASS}, then press Log In.
Okareo types the value into the field, and keeps it out of what the Driver, the app and the Checks see.
- Okareo UI
- Python
In the Target form, each secret is a row under Secrets: its Type, its name and its value. Add secret adds a row, and the trash icon removes one. With Type set to Text, the default, Okareo types the value as you gave it, such as a username, a password or a fixed code. With Type set to Authenticator key, the value is an authenticator key, and Okareo types its current six-digit code; see Sign-Ins That Ask for a Code.

Okareo holds each value you type. Once the Target is saved, the form shows each value as Secret redacted, and the Target's page lists the secrets by name only. To change a saved secret, click Replace, confirm, and type the new value; its name can change then too. A secret you leave as it is keeps its saved value. A saved secret keeps its Type, through Replace too, and its Type dropdown is disabled: to change the type, remove the row and add a new one.
Give the secrets as names or as values:
import os
from okareo_vision import Authenticator, BrowserConfig, VisionTarget
# Names: each value is read from the environment variable of that name.
portal = VisionTarget(
url="https://portal.example.com/login",
browser_config=BrowserConfig(host="hosted"),
secrets=["PORTAL_USER", "PORTAL_PASS"],
)
# Values: a string is typed as it is; Authenticator(seed) types the current six-digit code.
portal = VisionTarget(
url="https://portal.example.com/login",
browser_config=BrowserConfig(host="hosted"),
secrets={
"PORTAL_PASS": os.environ["PORTAL_PASS"],
"PORTAL_CODE": Authenticator(os.environ["PORTAL_TOTP_SEED"]),
},
)
unusable_secrets() names the secrets that cannot be typed now (an environment variable that is not set, or a seed that is not one), so a script can stop before it starts a Run:
unusable = portal.unusable_secrets()
if unusable:
raise SystemExit(f"Set these before the Run: {', '.join(unusable)}")
- A name is letters, digits and
_, and does not start with a digit. - An authenticator key, the seed
Authenticator(seed)takes, is the letters and digits a site shows in place of its QR code when you connect an authenticator app. Okareo types the six digits the app would show at that moment. - On a browser Okareo hosts, the values go to Okareo when the Target is registered, a seed included. A secret your machine holds no value for is refused there, by name.
- On the relay, the values stay on your machine. The relay reads each one when it types it.
- A secret the Target does not list cannot be typed: a Driver's prompt that names one is refused when the Run starts. Add it to
secrets, or take it out of the prompt. On the simulation page, the Target's card names any such secret once the Target and the Driver are picked, before the Run.
Never write a secret's value in the Driver's prompt, a Scenario row, or a Check.
Sign-Ins That Ask for a Code
Many sites ask for a verification code after the password whenever a sign-in comes from a browser they have not seen. A browser Okareo hosts is a new one for every conversation, so such a site asks every time. A simulation can answer when the code comes from an authenticator app: you save the app's key as an authenticator secret, and Okareo types the six-digit code the app would show at that moment.
The authenticator key is the letters and digits a site shows in place of its QR code when you connect an authenticator app, usually behind a link such as "I can't scan the QR code" or "Enter a setup key". Scanning the QR code connects your app but never shows the key, so ask the site for the key. Keep it as safe as the password: anyone with it can produce the account's codes.
Only authenticator apps are supported. A code the site sends by email or text message cannot be read by a simulation, and neither can a push to approve. Connect an authenticator app to the test account instead, as in the Salesforce example.
Saving an Authenticator Secret
- Okareo UI
- MCP
- Python
The Target lists the username, the password and the code. In the Target form, click Add secret under Secrets for each: PORTAL_USER and PORTAL_PASS with Type left at Text and their values, and PORTAL_CODE with Type set to Authenticator key and the key pasted as its value. Spaces and lowercase in the key do not matter. A value that is not an authenticator key is refused on its row before the Target is saved.

Once the Target is saved, the code's row shows Authenticator key as its Type, and the dropdown is disabled. Replace keeps it an authenticator secret. To make it a plain secret, remove the row and add a new one.
Ask an assistant connected to the Okareo MCP to save the Target, or call create_or_update_target with these arguments, "authenticator": true on the code's secret:
{
"name": "Portal",
"type": "vision",
"url": "https://portal.example.com/login",
"secrets": [
{ "name": "PORTAL_USER", "value": "<the username>", "authenticator": false },
{ "name": "PORTAL_PASS", "value": "<the password>", "authenticator": false },
{ "name": "PORTAL_CODE", "value": "<the authenticator key>", "authenticator": true }
]
}
Saving replaces the whole Target, so an update passes every secret's value again, the key included.
With okareo-vision, give the key as Authenticator(seed):
import os
from okareo_vision import Authenticator, BrowserConfig, VisionTarget
portal = VisionTarget(
url="https://portal.example.com/login",
browser_config=BrowserConfig(host="hosted"),
secrets={
"PORTAL_USER": os.environ["PORTAL_USER"],
"PORTAL_PASS": os.environ["PORTAL_PASS"],
"PORTAL_CODE": Authenticator(os.environ["PORTAL_CODE"]),
},
)
Authenticator(seed) ignores spaces and case in the key, and raises ValueError when the key is not one.
The Driver names the secret as {secret.NAME}, as it names any other, as the whole value of the code field:
Fill Username with {secret.PORTAL_USER}, then press Next.
Fill Password with {secret.PORTAL_PASS}, then press Log In.
When the page asks for a verification code, fill Verification Code with {secret.PORTAL_CODE}, then press Verify.
Okareo works out the code when it types it, so the code is always the current one. The Driver never sees the key or the code.
Example: Salesforce
Salesforce asks for a verification code whenever a sign-in comes from a browser it has not seen. By default it emails the code. With an authenticator app connected to the test user, it asks for the app's six-digit code instead. Set it up once, signed in to Salesforce as the test user:
- Click the avatar at the top right, then Settings.
- Open Advanced User Details.
- Find the line App Registration: One-Time Password Authenticator and click Connect. If the line says Disconnect, an app is already connected and its key cannot be shown again: click Disconnect, then Connect.
- Salesforce emails the user a verification code first. Enter it. This is the last time the emailed code is needed.
- On the QR code screen, click I Can't Scan the QR Code. Do not scan the code: scanning connects the app but never shows the key.
- Salesforce shows the key, a string of capital letters and digits. Copy it. This is the authenticator secret's value.
- Add the same key to an authenticator app of your own (Google Authenticator: +, then Enter a setup key, paste the key, choose Time based). Delete any entry for this user made earlier by scanning: a new connection makes a new key, and the old entry's codes stop working.
- Type the six digits the app shows into Salesforce to finish. A code changes every 30 seconds, so use a fresh one. Go through steps 4 to 8 without a long pause: the emailed code's approval runs out after a few minutes.
- Check it took: back in Advanced User Details, the line now says Disconnect. If Salesforce showed "Unable to Access Page" after the code, look at this line before trying again.
- Save in the Target the three secrets the Driver's prompt below names: the username as
SALESFORCE_USERNAMEand the password asSALESFORCE_PASSWORD, plain secrets, and the key asSALESFORCE_CODE, an authenticator secret, as in Saving an Authenticator Secret. Spaces in the key do not matter.
To confirm, sign in as the user from a private browser window. The Verify Your Identity page should say "Use the authenticator app on your mobile device to generate a verification code", not that a code was emailed.
The Driver's prompt then signs in with the username, the password and the code, one screen at a time:
Fill Username with {secret.SALESFORCE_USERNAME} and press Log In. The form then shows a Password box:
fill Password with {secret.SALESFORCE_PASSWORD} and press Log In.
If the page says Verify Your Identity and asks for a code from an authenticator app, fill Verification Code
with {secret.SALESFORCE_CODE} and press Verify. If it says the code was sent by email instead, end the
conversation saying so, and press nothing more.
Session ID
Many apps keep their own id for each chat, a conversation or session id in their own system. A vision Target can say where Okareo finds it. Okareo reads it during each conversation and saves it with the conversation, so each conversation in a Run can be matched to your own logs by your id. It is optional: without it, each conversation keeps Okareo's own id.
Okareo reads it from one of three places, the Source:
| Source | What Okareo reads | What you fill in |
|---|---|---|
Request header ("request_header") | A header on the API calls the page makes whose URL starts with the Request URL | Request URL (request_url) and Header name (name) |
Response body ("response_body") | A value in the JSON those calls return | Request URL (request_url) and Session ID Path (path) |
Page query parameter ("page_query_parameter") | A query parameter in the page's own URL | Parameter name (name) |
- Okareo UI
- Python
In the Target form, the Session ID group comes after Secrets. Pick a Source, and fill in the fields it shows. Not set, the default, reads nothing. Once the Target is saved, its page shows the Session ID's source and fields.

from okareo_vision import BrowserConfig, SessionId, VisionTarget
portal = VisionTarget(
url="https://portal.example.com/login",
browser_config=BrowserConfig(host="hosted"),
session_id=SessionId(
"request_header",
name="x-conversation-id",
request_url="https://api.example.com/v1/chat/",
),
)
The other sources take their own fields: SessionId("response_body", request_url="https://api.example.com/v1/chat/", path="response.conversation_id") and SessionId("page_query_parameter", name="conversationId"). SessionId raises ValueError for a field its source does not read, a field it needs and lacks, and anything the rules below refuse. It needs okareo-vision 0.4.1 or newer.
Registering a Target from Python replaces its settings, so a Target registered without session_id loses a Session ID set in the app.
- The Request URL is a full URL starting with
http://orhttps://, with no user name or password, no#and no space. A call matches when its URL starts with it, sohttps://api.example.com/v1/chat/matches every call under that path. - A header name matches in upper or lower case.
Authorization,Proxy-Authorization,CookieandSet-Cookiecarry sign-in details and cannot be used. - The Session ID Path is written the same way as a Custom Endpoint Target's Response Session ID Path: dotted keys, with list indexes such as
[0].response.conversation_idreadsconversation_idat the top of the JSON. - A response body is read only on a browser Okareo hosts, and only from the calls the page's script makes (
fetchorXMLHttpRequest). On the relay, a Target that names one is refused: use a request header or a page query parameter there. - The first id found is the conversation's. A value over 256 characters is never used. When Okareo finds no id, the conversation runs as usual and keeps Okareo's own id.
To find the id after a Run, open a conversation in the Run's page in Okareo. Its Metadata shows the id as Context token, with a button to copy it.
Page Events
Some pages show their chat, or switch a feature on, when an event fires on the page. fire_events fires those events after the page loads, in order, as a CustomEvent on the page's window with the name and detail you give:
from okareo_vision import BrowserConfig, PageEvent, VisionTarget
store = VisionTarget(
url="https://shop.example.com/",
browser_config=BrowserConfig(host="hosted"),
fire_events=[PageEvent("show-chat", detail=True)],
)
A page event is data, a name and a detail. Nothing you give is run as script.
BrowserConfig
BrowserConfig is the browser's settings as one group. Only host is required; a field left out keeps its default.
| Field | Default | What it does |
|---|---|---|
host | required | "hosted" or "client_relay"; see Where the Browser Runs. |
viewport | (1280, 900) | The size each conversation's page opens at, as width and height in pixels. |
max_parallel | 10 | How many conversations a Run holds open at once. On the relay, this is also how many pages the Chrome on your machine holds open at once. |
open_spacing_s | 0.0 | Seconds between the starts of a Run's conversations, so their pages open that far apart. 0 starts them all at once. |
page_open_timeout_s | 30.0 | How long a page may take to load, in seconds. At most 240. |
headless | True | On the relay only. False shows a window for each conversation. |
browser_args | () | On the relay only. Extra flags Chrome starts with, such as --proxy-server=... or --host-resolver-rules=.... |
BrowserConfig also takes channel and user_agent. No browser reads them today, so leave them unset.
Upgrading from 0.3
In 0.4, okareo-vision no longer drives a browser itself. Okareo does, and a Target is settings only.
- Move the steps to the Driver. Whatever your Target's code did on the page (close a notice, sign in, open the chat) goes at the top of the Driver's prompt, in plain words, one screen at a time.
- Name where the browser runs. Add
browser_config=BrowserConfig(host="hosted"), orhost="client_relay"for a page only your machine can reach. A Target with no host is refused. - Register the Target again. A Target saved by 0.3 is refused when a Run starts with it. Running
run_simulationwith the newVisionTargetregisters it again. - Sign in every conversation. No sign-in is saved between conversations. The Driver signs in, with its passwords and codes as secrets.
- Raise
max_turns. The steps to the chat are turns now, and count toward it. - Start Runs with
run_simulation. Theokareo-visioncommand is gone. - Install no browser for a hosted Target. A Target on a browser Okareo hosts needs no browser on your machine. On the relay, Okareo uses the Chrome or Chromium installed there.
Common Problems
The Page Never Shows a Chat
Open the conversation in the Run's page in Okareo. It shows each of the Driver's presses and the screen after it, so the step where the page did something the prompt did not expect is there to read. The Driver's prompt is where the chat gets opened: its first steps name the controls to press, and say that the first message goes in the message box once it shows.
A Conversation Runs Out of Turns Before the Chat
The sign-in and the steps to the chat are turns, and count toward the Run's max_turns. Raise it.
The Site Refuses Headless Chrome
Run the Target on the relay with headless=False. Sites with a bot check commonly let in only a real Chrome with a window. On a Linux server, run under xvfb-run.
The Relay Cannot Start Chrome
Install Google Chrome or Chromium, or set OKAREO_RELAY_CHROME to the path of the Chrome to start.
A Relay Target Is Refused When It Is Built
A Target on host="client_relay" needs okareo 0.0.163 or newer. Upgrade it with pip install -U okareo.
Sign-In Needs MFA
A code that can be produced without a person works: a test account's fixed code as a plain secret, or an authenticator app's key as an authenticator secret; see Sign-Ins That Ask for a Code. A sign-in only a person can pass, such as a push to approve or a code sent by email or text message, cannot run unattended.
The Run Will Not Start Because of a Secret
The Driver's prompt names a secret the Target does not list: add it to secrets, or take it out of the prompt. On a browser Okareo hosts, a secret your machine holds no value for is refused when the Target is registered: set its environment variable, and check with unusable_secrets().