AI Agents

AI coding agents can use the Plotly Cloud CLI to build, iterate on, and deploy Dash apps. This page covers how to set up your environment so agents can publish to Plotly Cloud.

Overview

AI agents that have shell access—such as Claude Code, Cursor, Windsurf, and GitHub Copilot—can run CLI commands on your behalf. With the Plotly Cloud CLI installed and authenticated, an agent can:

Setup

1. Install the CLI

Make sure dash[cloud] is installed in the environment your agent uses:

pip install "dash[cloud]"

2. Authenticate

Agents cannot complete the browser-based login flow on their own, so log in before starting your agent session:

plotly user login

The agent will then use your existing credentials for any CLI commands it runs. This means the agent operates with your personal permissions—it can access any apps and teams that you have edit permissions on.

Recommended: Always use personal authentication (plotly user login) with AI agents rather than API keys. This ensures the agent’s actions are scoped to your own permissions and are traceable to your account.

Example: Building and Deploying with an Agent

A typical agent workflow looks like this:

  1. Ask the agent to create a Dash app:
    Create a Dash app that shows a scatter plot of the iris dataset (px.data.iris()) with dropdowns to select the x and y columns.

The agent writes the code and can run it locally:
bash plotly app run

  1. Once you’re satisfied, ask the agent to publish:
    Publish this to Plotly Cloud as iris-explorer.

The agent runs:
bash plotly app publish --name iris-explorer

Tips

Agent-Specific Notes

Claude Code

Claude Code has shell access and can run plotly commands in its tool calls. Install and authenticate before starting your session.

Cursor / Windsurf

These IDE-based agents run commands in the integrated terminal. Ensure dash[cloud] is installed in the Python environment selected by your IDE.

GitHub Copilot (in VS Code)

Copilot’s terminal agent can run CLI commands when you use @terminal. Make sure your VS Code terminal has dash[cloud] installed and is authenticated.

Remote / Headless Agents

Agents running in non-interactive environments (containers, cloud VMs) cannot complete the browser-based OAuth flow required by plotly user login. Use an API key for authentication instead.

Troubleshooting

"Invalid token - credentials cleared"

This error message means that your session has expired. Run plotly user login again yourself, then resume the agent session. You can verify credentials are working with plotly user whoami.