This example demonstrates how to run the Strands Agent directly in a browser environment using Vite.
The agent uses the OpenAI model provider (via API Key) and has access to a tool (update_canvas) that allows it to modify the DOM elements on the page.
- Node.js 20+
- An OpenAI API Key (you will be prompted to enter this in the browser)
- Install dependencies from the root of the repo:
npm install
-
Navigate to this directory:
cd examples/browser-agent -
Start the development server:
npm run dev
-
Open the URL shown in the terminal (usually
http://localhost:5173). -
Enter your OpenAI API Key when prompted.
-
Interact with the agent! Try commands like:
- "Change the background color to soft blue"
- "Make the canvas a circle"
- "Change the text to Hello Strands!"