# swytchcodehq/swytchcode-examples architecture

> Architecture diagram of the GitHub repository swytchcodehq/swytchcode-examples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/swytchcodehq/swytchcode-examples
- Repository: https://github.com/swytchcodehq/swytchcode-examples

## Overview

This repository is a catalog of Swytchcode agent examples and reference architectures, not one unified runtime. Its user-to-result workflows vary by example: assistants submit or receive requests, workflow code orchestrates API operations through Swytchcode, and results are written back or delivered to users. The travel bridge and selected reporting and bug-escalation examples expose concrete internal calls; other examples are represented at their documented project boundary because their source was not sampled. Edges are limited to relationships shown in excerpts or documented in the README.

Main entry points: [`instinct-book-my-trip/instinct-bridge/bridge.py`](https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/bridge.py) (Sheet bridge), [`instinct-book-my-trip/instinct-bridge/flights.py`](https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/flights.py) (Flight operations), [`instinct-book-my-trip/instinct-bridge/swy.py`](https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/swy.py) (Policy execution), [`weekly-reporting-langgraph/main.py`](https://github.com/swytchcodehq/swytchcode-examples/blob/main/weekly-reporting-langgraph/main.py) (Weekly reporting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_travel["Travel booking"]
  node_travelbridge["Sheet bridge<br/>[bridge.py]"]
  node_sheetio["Trips sheet I/O<br/>[sheets.py]"]
  node_validation["Request validation<br/>[checks.py]"]
  node_flightops["Flight operations<br/>[flights.py]"]
  node_policyexec["Policy execution<br/>[swy.py]"]
  node_flighttext["Flight descriptions<br/>[describe.py]"]
  node_confirmation["Email confirmation<br/>[confirmation.py]"]
end

subgraph group_langgraph["LangGraph workflows"]
  node_bugflow["Bug escalation<br/>[main.py]"]
  node_weeklyflow["Weekly reporting<br/>[main.py]"]
  node_onboarding["Customer onboarding<br/>[main.py]"]
  node_paymentlink["Payment links<br/>[main.py]"]
  node_leadflow["Lead qualification<br/>[main.py]"]
  node_compliance["Multi-user compliance<br/>[main.py]"]
  node_calendarflow["Calendar workflow<br/>[main.py]"]
end

subgraph group_billing["Subscription lifecycle"]
  node_subscription_activation["Subscription activation"]
  node_entitlements["Entitlement sync"]
  node_first_recovery["First-payment recovery"]
  node_plan_change["Plan changes"]
  node_renewal_recovery["Renewal recovery"]
  node_webhook_reliability["Webhook reliability"]
end

subgraph group_integrations["Agent integrations"]
  node_github_issue["GitHub issue creation<br/>[index.ts]"]
  node_github_crewai["CrewAI GitHub agent<br/>[main.py]"]
  node_github_openai["Repository starring<br/>[main.py]"]
  node_openclaw_triage["OpenClaw issue triage<br/>[main.go]"]
  node_langswytch["Cognitive agent patterns"]
  node_refund_agent["Refund processing<br/>[run-workflow.js]"]
  node_starter_agent["CreateOS starter agent<br/>[agent.py]"]
  node_gmail_anthropic["Gmail assistant<br/>[index.ts]"]
end

subgraph group_webagent["Web chat agent"]
  node_chatui["Chat interface<br/>[Chat.tsx]"]
  node_chatroute["Chat API route<br/>[route.ts]"]
end

node_assistant(("Assistant / owner"))
node_google_sheets[("Google Sheets")]
node_duffel["Duffel flights"]
node_resend["Resend email"]

node_assistant -->|"submits requests"| node_travelbridge
node_travelbridge -->|"reads and writes"| node_sheetio
node_sheetio -->|"accesses sheet"| node_google_sheets
node_travelbridge -->|"validates rows"| node_validation
node_travelbridge -->|"dispatches actions"| node_flightops
node_flightops -->|"runs API calls"| node_policyexec
node_policyexec -->|"executes flight calls"| node_duffel
node_flightops -->|"formats results"| node_flighttext
node_flightops -->|"requests confirmation"| node_confirmation
node_confirmation -->|"formats details"| node_flighttext
node_confirmation -->|"sends through"| node_policyexec
node_policyexec -->|"executes email call"| node_resend
node_bugflow --> node_weeklyflow
node_assistant -->|"escalates bugs"| node_bugflow
node_bugflow --> node_weeklyflow
node_weeklyflow -->|"loads metrics"| node_google_sheets
node_weeklyflow -->|"emails report"| node_assistant
node_assistant -->|"starts onboarding"| node_onboarding
node_assistant -->|"requests payment link"| node_paymentlink
node_assistant -->|"qualifies leads"| node_leadflow
node_assistant -->|"runs compliance"| node_compliance
node_assistant -->|"manages calendar"| node_calendarflow
node_assistant -->|"creates issues"| node_github_issue
node_assistant -->|"requests GitHub work"| node_github_crewai
node_assistant -->|"stars repository"| node_github_openai
node_assistant -->|"triages issues"| node_openclaw_triage
node_assistant -->|"uses agent patterns"| node_langswytch
node_assistant -->|"requests refund"| node_refund_agent
node_assistant -.->|"runs starter agent"| node_starter_agent
node_assistant -.->|"uses Gmail assistant"| node_gmail_anthropic
node_assistant -->|"chats with agent"| node_chatui
node_chatui -.->|"sends chat"| node_chatroute

click node_travelbridge "https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/bridge.py"
click node_sheetio "https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/sheets.py"
click node_validation "https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/checks.py"
click node_flightops "https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/flights.py"
click node_policyexec "https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/swy.py"
click node_flighttext "https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/describe.py"
click node_confirmation "https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/confirmation.py"
click node_bugflow "https://github.com/swytchcodehq/swytchcode-examples/blob/main/bug-escalation-langgraph/main.py"
click node_weeklyflow "https://github.com/swytchcodehq/swytchcode-examples/blob/main/weekly-reporting-langgraph/main.py"
click node_onboarding "https://github.com/swytchcodehq/swytchcode-examples/blob/main/customer-onboarding-langgraph/main.py"
click node_paymentlink "https://github.com/swytchcodehq/swytchcode-examples/blob/main/create-and-send-payment-langgraph/main.py"
click node_leadflow "https://github.com/swytchcodehq/swytchcode-examples/blob/main/lead-qualification-langgraph/main.py"
click node_compliance "https://github.com/swytchcodehq/swytchcode-examples/blob/main/fintech-compliance-multiuser-langgraph/main.py"
click node_calendarflow "https://github.com/swytchcodehq/swytchcode-examples/blob/main/langgraph-google-calendar/main.py"
click node_subscription_activation "https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/activation-service/activationService.ts"
click node_entitlements "https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/entitlement-sync-service/entitlementSyncService.ts"
click node_first_recovery "https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/first-payment-recovery-service/firstPaymentRecoveryService.ts"
click node_plan_change "https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/plan-change-service/planChangeService.ts"
click node_renewal_recovery "https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/renewal-recovery-service/renewalRecoveryService.ts"
click node_webhook_reliability "https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/webhook-reliability-service/webhookReliabilityService.ts"
click node_github_issue "https://github.com/swytchcodehq/swytchcode-examples/blob/main/github-issue-integration/src/index.ts"
click node_github_crewai "https://github.com/swytchcodehq/swytchcode-examples/blob/main/github-agent-crewai-python/main.py"
click node_github_openai "https://github.com/swytchcodehq/swytchcode-examples/blob/main/star-repo-openai-agents-python/main.py"
click node_openclaw_triage "https://github.com/swytchcodehq/swytchcode-examples/blob/main/openclaw-swytchcode/main.go"
click node_langswytch "https://github.com/swytchcodehq/swytchcode-examples/blob/main/langswytch/langgraph_swytchcode_agent.py"
click node_refund_agent "https://github.com/swytchcodehq/swytchcode-examples/blob/main/swytchcode-refund-agent-openclaw/run-workflow.js"
click node_starter_agent "https://github.com/swytchcodehq/swytchcode-examples/blob/main/swytchcode-createos-starter-template/agent.py"
click node_gmail_anthropic "https://github.com/swytchcodehq/swytchcode-examples/blob/main/gmail-assistant-anthropic-typescript/src/index.ts"
click node_chatui "https://github.com/swytchcodehq/swytchcode-examples/blob/main/gmail-google-calender-openaisdk-demo/components/Chat.tsx"
click node_chatroute "https://github.com/swytchcodehq/swytchcode-examples/blob/main/gmail-google-calender-openaisdk-demo/app/api/chat/route.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_travelbridge,node_sheetio,node_validation,node_flightops,node_policyexec,node_flighttext,node_confirmation toneBlue
class node_bugflow,node_weeklyflow,node_onboarding,node_paymentlink,node_leadflow,node_compliance,node_calendarflow,node_google_sheets toneAmber
class node_subscription_activation,node_entitlements,node_first_recovery,node_plan_change,node_renewal_recovery,node_webhook_reliability toneMint
class node_github_issue,node_github_crewai,node_github_openai,node_openclaw_triage,node_langswytch,node_refund_agent,node_starter_agent,node_gmail_anthropic toneRose
class node_chatui,node_chatroute,node_assistant,node_duffel,node_resend toneIndigo
```

## Components

### Travel booking

- [Sheet bridge](https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/bridge.py): `instinct-book-my-trip/instinct-bridge/bridge.py`
- [Trips sheet I/O](https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/sheets.py): `instinct-book-my-trip/instinct-bridge/sheets.py`
- [Request validation](https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/checks.py): `instinct-book-my-trip/instinct-bridge/checks.py`
- [Flight operations](https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/flights.py): `instinct-book-my-trip/instinct-bridge/flights.py`
- [Policy execution](https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/swy.py): `instinct-book-my-trip/instinct-bridge/swy.py`
- [Flight descriptions](https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/describe.py): `instinct-book-my-trip/instinct-bridge/describe.py`
- [Email confirmation](https://github.com/swytchcodehq/swytchcode-examples/blob/main/instinct-book-my-trip/instinct-bridge/confirmation.py): `instinct-book-my-trip/instinct-bridge/confirmation.py`

### LangGraph workflows

- [Bug escalation](https://github.com/swytchcodehq/swytchcode-examples/blob/main/bug-escalation-langgraph/main.py): `bug-escalation-langgraph/main.py`
- [Weekly reporting](https://github.com/swytchcodehq/swytchcode-examples/blob/main/weekly-reporting-langgraph/main.py): `weekly-reporting-langgraph/main.py`
- [Customer onboarding](https://github.com/swytchcodehq/swytchcode-examples/blob/main/customer-onboarding-langgraph/main.py): `customer-onboarding-langgraph/main.py`
- [Payment links](https://github.com/swytchcodehq/swytchcode-examples/blob/main/create-and-send-payment-langgraph/main.py): `create-and-send-payment-langgraph/main.py`
- [Lead qualification](https://github.com/swytchcodehq/swytchcode-examples/blob/main/lead-qualification-langgraph/main.py): `lead-qualification-langgraph/main.py`
- [Multi-user compliance](https://github.com/swytchcodehq/swytchcode-examples/blob/main/fintech-compliance-multiuser-langgraph/main.py): `fintech-compliance-multiuser-langgraph/main.py`
- [Calendar workflow](https://github.com/swytchcodehq/swytchcode-examples/blob/main/langgraph-google-calendar/main.py): `langgraph-google-calendar/main.py`

### Subscription lifecycle

- [Subscription activation](https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/activation-service/activationService.ts): `Stripe-Subscriptions/services/activation-service/activationService.ts`
- [Entitlement sync](https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/entitlement-sync-service/entitlementSyncService.ts): `Stripe-Subscriptions/services/entitlement-sync-service/entitlementSyncService.ts`
- [First-payment recovery](https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/first-payment-recovery-service/firstPaymentRecoveryService.ts): `Stripe-Subscriptions/services/first-payment-recovery-service/firstPaymentRecoveryService.ts`
- [Plan changes](https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/plan-change-service/planChangeService.ts): `Stripe-Subscriptions/services/plan-change-service/planChangeService.ts`
- [Renewal recovery](https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/renewal-recovery-service/renewalRecoveryService.ts): `Stripe-Subscriptions/services/renewal-recovery-service/renewalRecoveryService.ts`
- [Webhook reliability](https://github.com/swytchcodehq/swytchcode-examples/blob/main/Stripe-Subscriptions/services/webhook-reliability-service/webhookReliabilityService.ts): `Stripe-Subscriptions/services/webhook-reliability-service/webhookReliabilityService.ts`

### Agent integrations

- [GitHub issue creation](https://github.com/swytchcodehq/swytchcode-examples/blob/main/github-issue-integration/src/index.ts): `github-issue-integration/src/index.ts`
- [CrewAI GitHub agent](https://github.com/swytchcodehq/swytchcode-examples/blob/main/github-agent-crewai-python/main.py): `github-agent-crewai-python/main.py`
- [Repository starring](https://github.com/swytchcodehq/swytchcode-examples/blob/main/star-repo-openai-agents-python/main.py): `star-repo-openai-agents-python/main.py`
- [OpenClaw issue triage](https://github.com/swytchcodehq/swytchcode-examples/blob/main/openclaw-swytchcode/main.go): `openclaw-swytchcode/main.go`
- [Cognitive agent patterns](https://github.com/swytchcodehq/swytchcode-examples/blob/main/langswytch/langgraph_swytchcode_agent.py): `langswytch/langgraph_swytchcode_agent.py`
- [Refund processing](https://github.com/swytchcodehq/swytchcode-examples/blob/main/swytchcode-refund-agent-openclaw/run-workflow.js): `swytchcode-refund-agent-openclaw/run-workflow.js`
- [CreateOS starter agent](https://github.com/swytchcodehq/swytchcode-examples/blob/main/swytchcode-createos-starter-template/agent.py): `swytchcode-createos-starter-template/agent.py`
- [Gmail assistant](https://github.com/swytchcodehq/swytchcode-examples/blob/main/gmail-assistant-anthropic-typescript/src/index.ts): `gmail-assistant-anthropic-typescript/src/index.ts`

### Web chat agent

- [Chat interface](https://github.com/swytchcodehq/swytchcode-examples/blob/main/gmail-google-calender-openaisdk-demo/components/Chat.tsx): `gmail-google-calender-openaisdk-demo/components/Chat.tsx`
- [Chat API route](https://github.com/swytchcodehq/swytchcode-examples/blob/main/gmail-google-calender-openaisdk-demo/app/api/chat/route.ts): `gmail-google-calender-openaisdk-demo/app/api/chat/route.ts`

### Other components

- **Assistant / owner**
- **Google Sheets**
- **Duffel flights**
- **Resend email**

## Connections

- Assistant / owner → Sheet bridge: submits requests (evidence: `instinct-book-my-trip/instinct-bridge/bridge.py`)
- Sheet bridge → Trips sheet I/O: reads and writes (evidence: `instinct-book-my-trip/instinct-bridge/bridge.py`)
- Trips sheet I/O → Google Sheets: accesses sheet (evidence: `instinct-book-my-trip/instinct-bridge/sheets.py`)
- Sheet bridge → Request validation: validates rows (evidence: `instinct-book-my-trip/instinct-bridge/bridge.py`)
- Sheet bridge → Flight operations: dispatches actions (evidence: `instinct-book-my-trip/instinct-bridge/bridge.py`)
- Flight operations → Policy execution: runs API calls (evidence: `instinct-book-my-trip/instinct-bridge/flights.py`)
- Policy execution → Duffel flights: executes flight calls (evidence: `instinct-book-my-trip/instinct-bridge/swy.py`)
- Flight operations → Flight descriptions: formats results (evidence: `instinct-book-my-trip/instinct-bridge/flights.py`)
- Flight operations → Email confirmation: requests confirmation (evidence: `instinct-book-my-trip/instinct-bridge/flights.py`)
- Email confirmation → Flight descriptions: formats details (evidence: `instinct-book-my-trip/instinct-bridge/confirmation.py`)
- Email confirmation → Policy execution: sends through (evidence: `instinct-book-my-trip/instinct-bridge/confirmation.py`)
- Policy execution → Resend email: executes email call
- Bug escalation → Weekly reporting
- Assistant / owner → Bug escalation: escalates bugs
- Bug escalation → Weekly reporting
- Weekly reporting → Google Sheets: loads metrics (evidence: `weekly-reporting-langgraph/main.py`)
- Weekly reporting → Assistant / owner: emails report (evidence: `weekly-reporting-langgraph/main.py`)
- Assistant / owner → Customer onboarding: starts onboarding
- Assistant / owner → Payment links: requests payment link
- Assistant / owner → Lead qualification: qualifies leads
- Assistant / owner → Multi-user compliance: runs compliance
- Assistant / owner → Calendar workflow: manages calendar
- Assistant / owner → GitHub issue creation: creates issues
- Assistant / owner → CrewAI GitHub agent: requests GitHub work
- Assistant / owner → Repository starring: stars repository
- Assistant / owner → OpenClaw issue triage: triages issues
- Assistant / owner → Cognitive agent patterns: uses agent patterns
- Assistant / owner → Refund processing: requests refund
- Assistant / owner → CreateOS starter agent: runs starter agent
- Assistant / owner → Gmail assistant: uses Gmail assistant
- Assistant / owner → Chat interface: chats with agent
- Chat interface → Chat API route: sends chat
