Quickstart: Use Browser Automation with the Copilot harness

Deploy a prompt agent that uses the Browser Automation Tool (BAT) through a toolbox. Foundry operates the Copilot harness and its isolated execution environment. You invoke the prompt agent through the Responses API rather than deploying a custom agent container.

This quickstart uses the Browser Automation Blog Research sample. BAT is generally available. The sample uses the Copilot harness preview, which requires a separate subscription and regional availability.

Prerequisites

  • An Azure subscription enabled for the microsoft_copilot_preview harness.
  • Permission to create Foundry and Playwright Workspace resources and write role assignments (Microsoft.Authorization/roleAssignments/write).
  • Azure Developer CLI 1.36.0 or later, Azure CLI, and Git.
  • The Foundry Azure Developer CLI extensions required by the sample. Its current configuration pins azure.ai.agents 1.0.0-beta.21 and azure.ai.projects 1.0.0-beta.14; follow the sample's version requirements.
  • At least 1,000 GPT-5.4 Global Standard capacity units in the selected Foundry region, as requested by this sample. Review the resource configuration and charges before deploying.

Step 1: Get the sample and choose regions

Download the sample directory from GitHub, or use a sparse checkout:

git clone --depth 1 --filter=blob:none --sparse \
  https://github.com/microsoft-foundry/foundry-samples.git foundry-browser-harness
cd foundry-browser-harness
git sparse-checkout set samples/cli/prompt-agents/microsoft-copilot-harness/browser-automation-blog-research
cd samples/cli/prompt-agents/microsoft-copilot-harness/browser-automation-blog-research

Sign in to the target tenant with Azure CLI and Azure Developer CLI:

az login
azd auth login
azd env new browser-automation-blog-dev \
  --subscription <subscription-id> \
  --location canadacentral

The sample defaults to Canada Central for Foundry and East US for the Playwright Workspace. The Foundry region must support the harness for your subscription. The Playwright region must support BAT. They don't have to be the same.

To change the browser region before deployment:

azd env set PLAYWRIGHT_LOCATION <supported-playwright-region>

To change the Foundry region, replace canadacentral in the environment creation command. Check regional and model support and the sample's prerequisites.

Step 2: Provision and deploy the prompt agent

From the sample directory, run:

azd up

The sample creates the Foundry account, project, model deployment, Playwright Workspace, workspace-scoped role assignment, Browser Automation connection, toolbox, remote-tool connection, and prompt agent.

Don't repeat the manual workspace and connection setup. This sample creates an isolated environment and uses project managed identity, without generating a Playwright access token.

There are two connection boundaries:

Connection Purpose
Playwright Workspace connection Lets the toolbox access the managed browser using the Foundry project identity.
Remote-tool connection Lets the Copilot harness agent access the toolbox's MCP endpoint.

The sample disables harness-native built-ins so the task must use the configured browser tools. Keep its browser tool allow list and cleanup instructions when evaluating the example.

Step 3: Run the research task

Invoke the deployed agent in a fresh conversation from the sample directory:

azd ai agent invoke browser-automation-blog-research \
  "$(cat prompts/blog-summary.md)" \
  --new-conversation \
  --timeout 1800

The supplied prompt asks the agent to inspect the rendered Foundry developer blog. The Azure Developer CLI invokes the deployed prompt agent; you don't start a local agent server.

Step 4: Verify browser execution and the result

Expect the rendered page title, three article links found on the page, and the requested page-structure description. Article titles vary as the blog changes.

Review tool-call activity to confirm session creation, navigation, page inspection, reuse of the same session ID, and session closure. Use Live View when available; treat its URL as sensitive. The final prose alone isn't evidence that BAT ran.

If agent creation returns a 403 indicating the harness isn't enabled, select an eligible Foundry region and subscription. Changing only the Playwright region doesn't enable the harness. For role-assignment failures, use an identity with permission to grant workspace access or ask an administrator.

Step 5: Clean up

Delete the sample environment when finished:

azd down

Review the listed resources before confirming deletion. Don't delete resources shared with other workloads. Check the sample README for any additional teardown requirements.