You build an AI agent on Amazon Bedrock AgentCore and deploy it from your Windows laptop. Everything works: the agent answers questions, calls its tools and remembers things.

Then you ask it to open a web page, and it crashes with PermissionError: [Errno 13].

The good news? Your code is probably fine. The problem may be a file permission that Windows doesn't preserve when your project is packaged for deployment.

This is one of those deployment errors that can be frustrating to track down because the agent itself appears to work perfectly. Let's look at what's happening and how to fix it.

In this post:

  • What the error looks like
  • Why it can happen when deploying from Windows
  • Two ways to fix it
  • How to check that the fix worked

What the error looks like

The deployment completes, and agentcore invoke runs successfully. But any request that needs the browser fails.

When you open your agent's logs in CloudWatch, you might find an error that ends with a line like this:

PermissionError: [Errno 13] Permission denied: '/var/task/playwright/driver/node' 

The path on your machine may look a little different. What matters is the ending: playwright/driver/node.

If you see that, keep reading.

The code that leads to this problem is usually nothing unusual. Here's a typical setup for giving an agent a browser tool:

from bedrock_agentcore.runtime import BedrockAgentCoreApp from strands import Agent from strands_tools.browser import AgentCoreBrowser REGION = "us-east-1" app = BedrockAgentCoreApp() browser_tool = AgentCoreBrowser(region=REGION) agent = Agent(tools=[browser_tool.browser]) 

Why it happens

First, a quick word about Playwright.

Playwright is a library that lets your code control a web browser. It can open a page, click buttons, fill in forms and read page content.

Think of it as a remote control for a browser.

AgentCore provides access to a browser running in AWS, while Playwright acts as the remote control your agent uses to interact with it.

Here's the catch.

The Python version of Playwright doesn't do all the work itself. It comes with a small helper program built on Node.js, which it launches in the background.

On Linux, a file needs an execute permission to run as a program. Think of this as a simple permission that tells Linux whether a file is allowed to run.

So, what goes wrong when you deploy from Windows?

  1. During deployment, the AgentCore CLI packages your project and its dependencies, including Playwright's helper program.
  2. Windows handles file permissions differently from Linux. When the project is packaged on Windows, the executable permission on Playwright's Node.js helper may not be preserved.
  3. The package reaches AWS, where your agent runs in a Linux environment.
  4. The first time your agent tries to use the browser, Playwright attempts to start its helper program.
  5. Linux sees a file that it isn't allowed to execute and refuses to run it.

That's when you get PermissionError: [Errno 13].

Your other tools may continue working because they're plain Python code. Playwright is different: it needs to launch a separate executable, which is where the permission problem shows up.

Fix 1: Deploy from Linux using WSL (the cleanest fix)

If you package your project from Linux, the executable permission can be preserved correctly. You don't need to change your agent code.

And no, you don't need a second computer.

WSL (Windows Subsystem for Linux) lets you run a Linux environment directly inside Windows. You can use Ubuntu to package and deploy your AgentCore project.

Here's how.

Step 1: Install WSL

Open PowerShell as Administrator and run:

wsl --install 

Restart your computer if prompted. Ubuntu is installed by default on most supported Windows setups.

Step 2: Copy your project into the Linux filesystem

Open Ubuntu and create a projects folder:

mkdir -p ~/projects 

Copy your project from Windows into your Linux home directory:

cp -r /mnt/c/Users/<you>/path/to/my-agent ~/projects/ 

Then navigate into it:

cd ~/projects/my-agent 

Important: Don't run the deployment directly from /mnt/c/.... That's still your Windows filesystem, and you may run into the same permission issue.

Work from your Linux home directory instead.

Step 3: Set up your deployment environment

Inside WSL, install the tools you need:

  • AWS CLI
  • uv (the direct_code_deploy option uses it to build your package)
  • AgentCore CLI

Configure your AWS credentials as you normally would.

Step 4: Deploy your agent

Use your usual AgentCore deployment commands. For example:

agentcore configure --entrypoint main.py --name my_agent \ --deployment-type direct_code_deploy --runtime PYTHON_3_13 agentcore deploy 

Before deploying, clean up your project folder. Remove unnecessary files such as old deployment archives, build leftovers and virtual environments that shouldn't be included in the package.

That's it. You're now packaging your project from Linux rather than Windows.

Fix 2: Restore the execute permission when the agent starts

What if you can't use WSL?

There's another approach. You can fix the permission problem when your agent starts, without changing the original file in the deployment package.

There's one snag: the application code in the AWS runtime is generally read-only, so you can't simply change the permissions on the original file.

The workaround is to:

  1. Copy Playwright's Node.js helper into /tmp, where your application can write files.
  2. Give the copied file execute permission.
  3. Tell Playwright to use the copied executable through the PLAYWRIGHT_NODEJS_PATH environment variable.

Add the following code near the top of your main.py, before setting up the browser tool:

import os import shutil from pathlib import Path import playwright def fix_playwright_node() -> None: """Make Playwright's bundled Node.js executable after a Windows-built deploy.""" src = Path(playwright.__file__).parent / "driver" / "node" if not src.exists() or os.access(src, os.X_OK): return # Nothing to fix  dst = Path("/tmp/playwright-node") if not dst.exists(): shutil.copy2(src, dst) dst.chmod(0o755) os.environ["PLAYWRIGHT_NODEJS_PATH"] = str(dst) fix_playwright_node() 

Why does this work?

Let's break it down.

  • It checks before making changes. If the original Node.js executable already has execute permission, the function does nothing.
  • It copies the file to a writable location. Instead of trying to modify the original file, it creates a copy in /tmp.
  • It restores the permission. chmod(0o755) gives the copied file the permissions needed to run.
  • It tells Playwright where to find the copy. The environment variable points Playwright to the new executable.

The timing matters here. The function must run before Playwright starts its helper process. That's why it belongs near the top of your application, before browser initialisation.

Then redeploy your agent:

agentcore deploy 

Check that it worked

Don't just assume the deployment fixed the problem. Give your agent a task that requires the browser.

For example:

agentcore invoke '{"prompt": "Open https://example.com and tell me the page title"}' 

If everything works, the agent should reply with the page title, which is "Example Domain".

You should also check the CloudWatch logs to confirm that the PermissionError is no longer appearing.

If the error persists, check the file path mentioned in the new error. It may be a different executable or a separate dependency issue.

Quick checklist

Before closing your debugging session, check these things:

  • The error mentions playwright/driver/node.
  • You deployed from WSL using your Linux home directory, not /mnt/c/, or you applied and verified the runtime workaround.
  • You cleaned up unnecessary build files before packaging.
  • You deployed again using agentcore deploy.
  • You tested a browser request.
  • The agent returned the page title without a permission error.

The takeaway

When something works on your Windows machine but fails after deployment to Linux, don't immediately start rewriting your agent.

Sometimes the problem isn't your Python code at all. It may be something as small as a file permission that didn't survive packaging.

Have you run into a different AgentCore deployment error? Tell me in the comments. I may cover it in a future post.

I drafted this post with help from an AI assistant, then tested the fixes and edited it myself.