This guide provides step-by-step instructions to set up the Google Workspace Agent, including Google Cloud credentials and the required CLI tools.
- Python 3.10+ (3.11 recommended)
- Google Cloud Account (Free tier works)
- OpenRouter API Key (Required for LLM planning)
-
Clone the repository:
git clone https://github.com/haseeb-heaven/gworkspace-agent.git cd gworkspace-agent -
Create a virtual environment:
# Windows python -m venv .venv .venv\Scripts\activate # macOS / Linux python -m venv .venv source .venv/bin/activate
-
Install the package:
pip install -e .
The agent relies on the Google Workspace CLI to interact with Google Services.
- Go to the GitHub Releases page.
- Download the version for your operating system:
- Windows:
google-workspace-cli-x86_64-pc-windows-msvc.zip(containsgws.exe) - macOS:
google-workspace-cli-x86_64-apple-darwin.tar.gz - Linux:
google-workspace-cli-x86_64-unknown-linux-musl.tar.gz
- Windows:
- Extract the file and move the
gws(orgws.exe) binary to a folder on your computer. - Add to PATH: Ensure the folder containing the binary is in your system's
PATHenvironment variable.- Verification: Open a new terminal and type
gws --version.
- Verification: Open a new terminal and type
You need a Google Cloud Project to authorize the agent. You can do this automatically or manually.
If you have the Google Cloud SDK (gcloud) installed:
- Run:
gws auth setup
- Follow the prompts to create a project and enable APIs automatically.
- Create a Project: Go to the Google Cloud Console and create a new project.
- Enable APIs: Enable the following APIs in the "Library" section. Refer to the table below for the complete list of supported services and their enable URLs.
| API | GWS Commands | Enable |
|---|---|---|
| Gmail API | list_messages, get_message, send_message, trash_message, delete_message | Enable |
| Google Drive API | list_files, create_folder, upload_file, get_file, create_file, export_file, delete_file, move_to_trash, update_file_metadata, move_file, copy_file | Enable |
| Google Sheets API | create_spreadsheet, get_spreadsheet, get_values, append_values, delete_spreadsheet, clear_values | Enable |
| Google Docs API | create_document, get_document, batch_update | Enable |
| Google Calendar API | list_events, create_event, get_event, delete_event, update_event | Enable |
| Google Tasks API | list_tasklists, list_tasks, create_task, delete_task, update_task | Enable |
| Google Slides API | create_presentation, get_presentation | Enable |
| Google Contacts API | list_contacts, list_directory_people, get_person | Enable |
| Google Chat API | list_spaces, send_message, list_messages, get_message | Enable |
| Google Meet API | list_conferences, get_conference, create_meeting | Enable |
| Google Keep API | list_notes, create_note, get_note, delete_note | Enable |
| Google Admin SDK Reports API | list_activities, log_activity | Enable |
- Configure OAuth Consent Screen:
- Go to APIs & Services > OAuth consent screen.
- Select External.
- Add your email as a Test User (Mandatory).
- Create Credentials:
- Go to APIs & Services > Credentials.
- Click Create Credentials > OAuth client ID.
- Select Desktop app.
- Download the JSON file and rename it to
client_secret.json.
- Place the Secret:
- Windows: Move it to
C:\Users\<YourUser>\.config\gws\client_secret.json - macOS/Linux: Move it to
~/.config/gws/client_secret.json
- Windows: Move it to
Once the credentials are in place, run:
gws auth loginThis will open your browser. Log in with your Google account and grant the requested permissions.
- Initialize the Agent:
python gws_cli.py --setup
- The wizard will ask for:
- Path to the
gwsbinary (if not in PATH). - Your OpenRouter API Key.
- Optional keys (Tavily, E2B).
- Path to the
- The configuration will be saved to a
.envfile.
Run a simple task to verify everything is working:
python gws_cli.py --task "List my 5 most recent Drive files"- gws not found: Ensure
gwsis in your PATH or specify the full path duringpython gws_cli.py --setup. - Authentication errors: Ensure you added your email as a Test User in the Google Cloud OAuth consent screen.
- Binary downloads: Always get the latest binary from the official releases.