
Chris Parmer
October 21, 2026
Let Your AI Agent Test Your Dash Apps, Even Behind a Login
Coding agents have gotten very good at writing Dash apps. Until recently they've had a blind spot: they couldn't see the app they just built. They'd write a callback, deploy it, and then ask you to go check whether it worked.
That's changing. An agent like Claude Code can now open your deployed app in a headless browser, click around like a user, read the browser console, pull the server logs, fix what it finds, redeploy, and check again. Nobody has to sit and watch while it does.
This post walks through how to set that up for apps on Plotly Cloud and Dash Enterprise, including apps that sit behind a login. We ran everything here with Claude Code on the web, in a cloud sandbox with no access to anyone's laptop. If you're new to agents or headless browsers, this is written for you.
The loop we're after
Here's what the agent does on its own once it's set up:
- Change the app's code
- Deploy it with the CLI
- Open the app in a headless browser, wait for it to load, and click through it
- Check the browser console and network for errors
- Read the app's server logs when something's off
- Fix, redeploy, and run the same checks again
The interesting part is the middle. Agents can write and deploy code already. Giving them eyes on the running app is what lets them close the loop without you.
Step 1: Let the agent log in with the device flow
Your Plotly Cloud apps are private by default, so a browser that isn't signed in just gets redirected to the login page. The agent needs a way to sign in without you handing it your password.
That's what the device flow is for. You've probably used it to sign in to a TV app: the device shows a short code, you open a link on your phone or laptop, approve it, and the device gets signed in. The agent never sees your password, and you stay in control of what it can access.
The agent starts the login with the Plotly Cloud CLI:
pip install plotly-cloudplotly user login --no-browser
The CLI prints a link and a code, and waits:
ââ » Please open the URL in your browser to authenticate ââââââââââźâ â Verification URL: https://signin.cloud.plotly.com/device ââ â Device Code: VTHV-PKWD ââ°ââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââŻâ Waiting for authorization...
The agent sends you the link and code, you approve, and the CLI finishes with â Successfully logged in to Plotly Cloud! The token gets saved to ~/.plotly-cloud.
One thing to know: the access token lasts 15 minutes. Any CLI command that talks to the API, like plotly app list, refreshes it. Our first browser runs failed with what looked like timeouts. The token had expired and the app was quietly redirecting to the login page. Refreshing the token before each run fixed it.
Step 2: Decide between curl and a browser
With the token in hand, the agent can talk to your app. It doesn't always need a browser to do that. Plotly Cloud accepts the token as a standard Authorization: Bearer header:
TOKEN=$(python3 -c "import json;print(json.load(open('$HOME/.plotly-cloud'))['access_token'])")curl -H "Authorization: Bearer $TOKEN" https://<your-app>.plotly.app/_dash-layoutcurl -H "Authorization: Bearer $TOKEN" https://<your-app>.plotly.app/_dash-dependencies
Without the header you get a 302 redirect to the login page. With it you get the app's layout and its list of callbacks as JSON. The agent can even call a callback directly by POSTing to /_dash-update-component, which makes a quick smoke test for a single callback.
A rough guide for when to use which:
- curl for "is it up?", "does auth work?", and "what does this callback return for these inputs?" It's fast and needs nothing installed.
- A headless browser for anything about what a person sees: layout, loading states, clicks, charts, and JavaScript errors. curl doesn't run JavaScript, and a Dash app is mostly JavaScript once it's in the browser.
- Server logs for why something broke.
Step 3: Drive the app with a headless browser
To show the full loop we built a small sample app, Weather Stations. It has the things that trip up automated testing in real apps: a slow callback (2.5 seconds, like a warehouse query), a dropdown, a slider, a chart you can click, and server-side logging. One station, Harbor, has no data, and the first version of the app didn't handle that.
We used Playwright, a library for controlling a real browser from Python. The core of the script is short. It adds your token to every request that goes to your app (and only to your app), loads the page, and waits for Dash:
from urllib.parse import urlparsefrom playwright.sync_api import sync_playwrightAPP = "https://<your-app>.plotly.app/"TOKEN = ... # access_token from ~/.plotly-clouddef add_token(route, request):headers = dict(request.headers)if urlparse(request.url).hostname == urlparse(APP).hostname:headers["authorization"] = f"Bearer {TOKEN}"route.continue_(headers=headers)def wait_for_dash(page):page.wait_for_selector("#react-entry-point")page.wait_for_function("""() =>!document.querySelector('[data-dash-is-loading="true"]')&& !document.querySelector('.dash-spinner')""")with sync_playwright() as p:page = p.chromium.launch().new_page()page.route("**/*", add_token)page.on("console", lambda m: print("console:", m.type, m.text))page.on("response", lambda r: r.status >= 400 and print("HTTP", r.status, r.url))page.goto(APP, timeout=90_000)wait_for_dash(page)page.screenshot(path="loaded.png", full_page=True)
Wait for the app, not the page
The HTML for a Dash app arrives almost immediately. The data doesn't. If the agent takes its screenshot when the page "loads", it captures a spinner.
Dash marks components with data-dash-is-loading while callbacks are running, and dcc.Loading shows a spinner. Waiting until both are gone is reliable. Two waits you might reach for first don't hold up: a fixed sleep breaks as soon as a query gets slower, and Playwright's networkidle never fires on apps that keep a connection open.
Also give the very first page load a generous timeout. Right after a deploy, the first request can take a while as the app warms up. Ours timed out at 30 seconds once, then loaded fine on the next try.
Click around like a user
Once the page is ready, the agent interacts with it, then waits for Dash again after every action:
# Dropdown: open it, then pick an option by its visible namepage.click("#station")page.get_by_role("option", name="Downtown").click()wait_for_dash(page)# Slider: use the keyboard on the handle. Clicking the "90" label doesn't land,# because the slider's track sits on top of its labels.page.locator("#window [role=slider]").press("End")wait_for_dash(page)# Chart: Plotly draws points as SVG, so click one directlypage.locator("#chart .scatterlayer .point").nth(20).click(force=True)
The slider is a good example of what the agent runs into in practice. Its first attempt clicked the "90" mark, and Playwright reported that another element was intercepting the click. The agent switched to keyboard input on the slider handle, which is also how a keyboard user would do it, and that worked every time.
Step 4: Don't trust the screenshot, check the console
Next the agent picked Harbor, the station with no data, and took a screenshot.
Nothing on screen looks broken. The dropdown says Harbor and the chart looks normal. But the summary line still says Downtown. When a Dash callback fails, the app keeps showing whatever it had before. A person might miss that, and an agent that only looks at screenshots would too.
The console and network capture catch it right away:
== console ==[error] Failed to load resource: the server responded with a status of 500 ()[error] Callback error updating ..summary.children...chart.figure..== HTTP errors ==500 POST /_dash-update-component
This is why every browser run should collect console messages and HTTP errors, and treat any of them as a failure.
Step 5: Read the logs, fix it, check again
A 500 from a callback means Python raised an exception on the server. The agent pulls the runtime logs with the CLI:
COLUMNS=400 plotly app logs --type runtime
(The wide COLUMNS stops the CLI from wrapping long log lines into a narrow box.) The app's own logging and the traceback point straight at the problem:
INFO update: station=Harbor window=14ERROR Exception on /_dash-update-component [POST]Traceback (most recent call last):...File "/home/appuser/app/app.py", line 77, in updatelatest = df.iloc[-1]IndexError: single positional indexer is out-of-bounds
Harbor has no rows, so df.iloc[-1] fails. The agent added a guard:
df = DATA[DATA.station == station].tail(window)if df.empty:log.warning("update: no readings for %s", station)return f"No readings for {station} yet. Its sensor feed is offline.", {}latest = df.iloc[-1]
Then it redeployed with plotly app publish and ran the exact same browser walkthrough again. This time Harbor shows a clear message, and the console and HTTP error lists both come back empty.
That's the whole loop: reproduce in the browser, find the cause in the logs, fix, redeploy, and verify with the same test. The agent did all of it in one run, without anyone checking in between steps.
Dash Enterprise: let the logs be the agent's eyes
Dash Enterprise has its own CLI with the same device-flow login, backed by your Dash Enterprise identity provider:
pip install --extra-index-url https://<your-de-host>/packages de-clientde --host <your-de-host> login
The CLI prints a link with a code built in. You approve it, and the agent can deploy, check status, and read logs:
de deploy . --name weather-stations -yde apps status --name weather-stationsde apps logs --name weather-stations --type runtime
Visiting the app in a browser is where Dash Enterprise differs. The app itself sits behind a separate browser sign-in that doesn't accept the CLI's token, so the browser approach above doesn't carry over. For Dash Enterprise, the logs are the right way for an agent to see what's happening:
- Add Python logging to the parts of your app you care about, so callbacks report what they did
- Have the agent read build logs after every deploy and runtime logs after testing
- Run the browser walkthrough against the app locally (de run or python app.py) before deploying, where no login is involved
Two practical notes. Dash Enterprise device codes expire after a few minutes. If nobody approves in time, the CLI exits with an unfriendly AttributeError instead of saying the code expired, so just run de login again. The Dash Enterprise token lasts 24 hours, so in practice you approve once a day.
Edge case: apps that use WebSockets
Most Dash apps send callbacks over plain HTTP, and everything above works as written. Some newer apps run callbacks over a WebSocket instead. You'll know you've hit one when the page stays on "LoadingâŠ" and the console shows WebSocket handshake: Unexpected response code: 302.
Browsers don't let pages attach custom headers to a WebSocket connection, and Playwright's request routing doesn't reach it either. So the token never makes it to the WebSocket. The fix is a small local proxy: the browser talks to http://127.0.0.1:8765, and the proxy forwards everything to your app with the token attached, WebSocket included. It's about 60 lines of Python with aiohttp, and it's included in the skill below. For these apps curl is also less useful, because the page content arrives over the WebSocket.
Give your agent the recipe
Everything above took some trial and error to work out. You don't want your agent repeating that every session. We packaged it as a skill: a short instruction file plus helper scripts the agent loads when it needs them. For Claude Code, drop it in .claude/skills/ in your repo.
If you'd rather start from a prompt, here's a condensed version you can paste into any coding agent:
Test my deployed Dash app at <APP_URL> the way a user would.1. Log in: run `plotly user login --no-browser` in the background, send me theURL and device code, and wait for me to approve. The token is in~/.plotly-cloud and expires after 15 minutes; run `plotly app list` torefresh it before each session.2. Smoke test with curl and `Authorization: Bearer <token>`: `/` and`/_dash-layout` should return 200.3. Use Playwright (Python). Add the bearer header only to requests whose host isthe app's host. After loading and after every action, wait until there's no`[data-dash-is-loading="true"]` and no `.dash-spinner` (don't usenetworkidle). Use a 90 second timeout for the first load.4. Click through the main controls. For dropdowns, click the control and thenthe option by role. For sliders, press keys on `[role=slider]`. For chartpoints, click `.scatterlayer .point` with force=True.5. Record every console message and every HTTP response >= 400. Treat any ofthem as a failure, even if the screenshot looks fine. Take a full-pagescreenshot after each step and look at it.6. On failure, read `COLUMNS=400 plotly app logs --type runtime`, find thetraceback, fix the code, `plotly app publish`, and repeat steps 3 to 5 untilthe console and HTTP errors are clean.7. If the page sticks on "LoadingâŠ" with a WebSocket 302 in the console, theapp uses WebSockets: run a local reverse proxy that adds the header to bothHTTP and WebSocket traffic, and point the browser at it.8. For Dash Enterprise, use `de --host <host> login`, then `de deploy`,`de apps status` and `de apps logs`. DE apps can't be browsed with the CLItoken, so rely on logs, and test locally first.Never print the token or send it anywhere except the app.
Try it
The pieces here are all off the shelf: the Plotly Cloud CLI, Playwright, and a coding agent that can run commands. Put them together and your agent stops guessing whether a change worked and goes and looks. It finds the bug that a screenshot hides, reads the traceback, and checks its own fix before telling you it's done.
If you don't have a Plotly Cloud account yet, create one for free. To give your agent the Dash docs as well, see the Dash Docs MCP server.