Google Workspace Examples
Google Workspace integration workflow examples for the Loopstack automation framework.
Two ways to use the @loopstack/google-workspace-module tools:
- A scripted summary workflow — fetches calendar events with a custom tool and renders them
- An interactive agent workflow — Claude with Calendar, Gmail, and Drive tools
Both share the same sign-in pattern: when a tool returns unauthorized, launch the OAuthWorkflow sub-workflow inline, then retry.
Install as Source (Recommended)
npx giget@latest gh:loopstack-ai/loopstack/registry/examples/google-workspace-examples src/google-workspace-examplesThen register the module:
import { Module } from '@nestjs/common';import { LoopstackModule } from '@loopstack/loopstack-module';import { GoogleWorkspaceExamplesModule } from './google-workspace-examples/google-workspace-examples.module';
@Module({ imports: [LoopstackModule.forRoot(), GoogleWorkspaceExamplesModule],})export class AppModule {}Install as a Dependency
npm install @loopstack/google-workspace-examplesimport { GoogleWorkspaceExamplesModule } from '@loopstack/google-workspace-examples';Required app-module configuration
Both examples use Claude via @loopstack/llm-provider-module — @Global, configured once in your root module to set the default model:
import { Module } from '@nestjs/common';import { GoogleWorkspaceExamplesModule } from '@loopstack/google-workspace-examples';import { LlmProviderModule } from '@loopstack/llm-provider-module';import { LoopstackModule } from '@loopstack/loopstack-module';
@Module({ imports: [ LoopstackModule.forRoot(), LlmProviderModule.forRoot({ model: 'claude-sonnet-4-6' }), GoogleWorkspaceExamplesModule, ],})export class AppModule {}GoogleWorkspaceExamplesModule re-imports ClaudeModule and GoogleWorkspaceModule. GoogleWorkspaceModule transitively pulls in the global OAuthModule and registers the Google OAuth provider — no additional OAuth wiring required in your AppModule.
Environment
ANTHROPIC_API_KEY=sk-ant-...GOOGLE_CLIENT_ID=...GOOGLE_CLIENT_SECRET=...Refer to @loopstack/google-workspace-module for the full OAuth setup (redirect URL, scopes).
Running
Start a workflow from Studio (app Google Workspace Examples) or with the Loopstack CLI:
loopstack run google_calendar_summary_example --arg calendarId=primaryloopstack run google_workspace_agent_exampleOn the first run you are asked to sign in to Google; after that the summary renders your upcoming events as markdown, and the agent waits for your chat messages.
Examples
| Example | Studio title | Description |
|---|---|---|
| Google Calendar Summary | Google Workspace - Calendar Summary Example |
Scripted calendar fetch + markdown summary |
| Google Workspace Agent | Google Workspace - Agent Example |
Interactive Claude agent with Calendar, Gmail, and Drive tools |
Google Calendar Summary
Fetches the user’s upcoming calendar events via GoogleCalendarFetchEventsTool and renders a markdown summary. On unauthorized it launches the OAuthWorkflow sub-workflow inline and retries.
Files
google-calendar-summary-example.workflow.ts— workflow classtemplates/calendarSummary.md— Handlebars markdown summary../../shared/google/google-calendar-fetch-events.tool.ts— custom calendar tool
Google Workspace Agent
An interactive Claude chat agent with 11 Google Workspace tools (Calendar, Gmail, Drive). When a tool returns unauthorized, the agent calls authenticateGoogle to launch the OAuth sub-workflow and retries.
Files
google-workspace-agent-example.workflow.ts— workflow classgoogle-workspace-agent-example.ui.yaml— chat prompt-input widgettemplates/systemMessage.md— system prompt
About
Author: Jakob Klippel
License: MIT