Skip to content

[Bug] agents-cli playground fails on Windows due to wildcard expansion of --allow_origins "*" #34

@Abdullah-k0de

Description

@Abdullah-k0de

What happened?

Running agents-cli playground on Windows crashes with Error: Got unexpected extra arguments showing files from the current working directory.

Steps to Reproduce

  1. Create an agent project on Windows.
  2. Open a terminal inside the project root folder.
  3. Run agents-cli install
  4. Run agents-cli playground

What did you expect to happen?

The local playground server starts successfully and hosts the web UI at http://127.0.0.1:8080/dev-ui/

Client information

CLI version: 0.5.0
CLI install path: C:\Users\abdul\AppData\Roaming\uv\tools\google-agents-cli\Lib\site-packages\google\agents\cli
OS info: Windows-11-10.0.26200-SP0
Installed skills: none

Project root: C:\Users\abdul\OneDrive\Desktop\Comp Lang NEW\Antigravity - agy-cli-projects\weather-assistant
Project name: weather-assistant
Deployment target: none
Agent directory: app
Region: us-east1

Command Output / Logs

agents-cli playground
Starting your agent playground...
Running command: uv run adk web . --host 127.0.0.1 --port 8080 --allow_origins '*' --reload_agents
Will be available at: http://127.0.0.1:8080/dev-ui/?app=app
Usage: adk web [OPTIONS] [AGENTS_DIR]
Try 'adk web --help' for help.

Error: Got unexpected extra arguments (app Dockerfile GEMINI.md pyproject.toml README.md tests uv.lock)
agents-cli v0.5.0
Error: Failed to start playground (exit code 2)

Anything else we need to know?

Cause:

When Python launches the command via uv run, the adk.exe launcher wrapper (which is compiled with MSVC's setargv.obj) automatically expands the * wildcard in --allow_origins "*" into all filenames in the current directory before passing it to Python. Click then interprets these filenames as unexpected positional arguments.

Proposed Fix:

In google/agents/cli/dev/cmd_playground.py, escape/quote the asterisk argument on Windows to prevent the launcher's C runtime from expanding it:

     browser_host = "127.0.0.1" if host == "0.0.0.0" else host
     url = f"http://{browser_host}:{port}/dev-ui/?app={cfg.agent_directory}"
 
+    import sys
+    allow_origins = '"*"' if sys.platform == "win32" else "*"
     args = [
         "uv",
         "run",
@@ -66,7 +66,7 @@
         "--port",
         str(port),
         "--allow_origins",
-        "*",
+        allow_origins,
     ]
     if reload_agents:
         args.append("--reload_agents")


---

*Contribution & Recognition:*
*   I have signed the Google Individual CLA (under the name Abdullah).
*   Since this fix resolves a blocker for Windows users, I would appreciate being credited for this contribution when the fix is applied.
*   Once merged, I would also love to be nominated for the Google Open Source Peer Bonus program.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions