# osteensco/switchboard architecture

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

- Interactive diagram: https://gitdiagram.com/osteensco/switchboard
- Repository: https://github.com/osteensco/switchboard

## Overview

Switchboard is a serverless, durable workflow orchestration framework with a Python runtime SDK and a Go CLI. The principal workflow is triggered by a message, resumes from persisted state, dispatches individual or parallel tasks, and advances when task responses return through the invocation queue. The README also documents deployment templates and CLI resource management, logging, and troubleshooting. The sampled SDK supports AWS and custom database/queue interfaces; other cloud implementations are incomplete or unsampled, so those links are not asserted.

Main entry points: [`sdk/py/src/switchboard/db.py`](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/db.py) (Database interface), [`sdk/py/src/switchboard/workflow.py`](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/workflow.py) (Workflow engine), [`cli/src/cmd`](https://github.com/osteensco/switchboard/tree/main/cli/src/cmd) (Developer CLI), [`sdk/py/src/switchboard/executor.py`](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/executor.py) (Task executor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Workflow runtime"]
  node_invocation_queue["Invocation queue"]
  node_executor_queue["Executor queue"]
end

subgraph group_sdk["Python SDK"]
  node_trigger["Workflow trigger<br/>[response.py]"]
  node_workflow["Workflow engine<br/>[workflow.py]"]
  node_schemas["Execution schemas<br/>[schemas.py]"]
  node_enums["Runtime enums<br/>[enums.py]"]
  node_executor["Task executor<br/>[executor.py]"]
  node_response["Task response<br/>[response.py]"]
  node_invocation["Queue dispatch<br/>[invocation.py]"]
  node_logging["Structured logging<br/>[logging_config.py]"]
end

subgraph group_storage["State and cloud"]
  node_state_store[("Workflow state store")]
  node_db_sdk["Database interface<br/>[db.py]"]
  node_cloud["Cloud adapters<br/>[cloud.py]"]
end

subgraph group_tooling["CLI and infrastructure"]
  node_cli["Developer CLI"]
  node_cli_deploy["Deployment management<br/>[deployer.go]"]
  node_cli_scaffold["Project scaffolding<br/>[scaffolder.go]"]
  node_cli_observe["Logs and monitoring"]
  node_templates["AWS infrastructure templates"]
end

node_user(("Workflow owner"))
node_user_tasks["User task functions"]

node_user -->|"starts run"| node_trigger
node_trigger -->|"sends message"| node_invocation_queue
node_invocation_queue -->|"invokes"| node_workflow
node_workflow -->|"reads and writes"| node_db_sdk
node_db_sdk -->|"persists state"| node_state_store
node_db_sdk -->|"connects through"| node_cloud
node_workflow -->|"enqueues tasks"| node_executor_queue
node_executor_queue -->|"dispatches"| node_executor
node_executor -->|"calls task"| node_user_tasks
node_executor -->|"creates response"| node_response
node_user_tasks -->|"reports completion"| node_response
node_response -->|"sends response"| node_invocation
node_invocation -->|"discovers endpoint"| node_db_sdk
node_invocation -->|"pushes message"| node_cloud
node_workflow -->|"uses state models"| node_schemas
node_db_sdk -->|"serializes state"| node_schemas
node_db_sdk -->|"selects resources"| node_enums
node_workflow -->|"tracks step status"| node_enums
node_workflow -->|"logs execution"| node_logging
node_db_sdk -->|"logs storage activity"| node_logging
node_user -->|"manages workflows"| node_cli
node_cli -.->|"deployment support"| node_cli_deploy
node_cli -.->|"project setup"| node_cli_scaffold
node_cli -.->|"observability support"| node_cli_observe
node_cli_deploy -.->|"uses templates"| node_templates

click node_trigger "https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/response.py"
click node_workflow "https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/workflow.py"
click node_db_sdk "https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/db.py"
click node_schemas "https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/schemas.py"
click node_enums "https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/enums.py"
click node_executor "https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/executor.py"
click node_response "https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/response.py"
click node_invocation "https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/invocation.py"
click node_cloud "https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/cloud.py"
click node_logging "https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/logging_config.py"
click node_cli "https://github.com/osteensco/switchboard/tree/main/cli/src/cmd"
click node_cli_deploy "https://github.com/osteensco/switchboard/blob/main/cli/src/core/deployer.go"
click node_cli_scaffold "https://github.com/osteensco/switchboard/blob/main/cli/src/core/scaffolder.go"
click node_cli_observe "https://github.com/osteensco/switchboard/tree/main/cli/src/core"
click node_templates "https://github.com/osteensco/switchboard/tree/main/cli/src/assets/templates/aws"

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_invocation_queue,node_executor_queue toneBlue
class node_trigger,node_workflow,node_schemas,node_enums,node_executor,node_response,node_invocation,node_logging toneAmber
class node_state_store,node_db_sdk,node_cloud toneMint
class node_cli,node_cli_deploy,node_cli_scaffold,node_cli_observe,node_templates,node_user_tasks toneRose
class node_user toneIndigo
```

## Components

### Workflow runtime

- **Invocation queue**
- **Executor queue**

### Python SDK

- [Workflow trigger](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/response.py): `sdk/py/src/switchboard/response.py`
- [Workflow engine](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/workflow.py): `sdk/py/src/switchboard/workflow.py`
- [Execution schemas](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/schemas.py): `sdk/py/src/switchboard/schemas.py`
- [Runtime enums](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/enums.py): `sdk/py/src/switchboard/enums.py`
- [Task executor](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/executor.py): `sdk/py/src/switchboard/executor.py`
- [Task response](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/response.py): `sdk/py/src/switchboard/response.py`
- [Queue dispatch](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/invocation.py): `sdk/py/src/switchboard/invocation.py`
- [Structured logging](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/logging_config.py): `sdk/py/src/switchboard/logging_config.py`

### State and cloud

- **Workflow state store**
- [Database interface](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/db.py): `sdk/py/src/switchboard/db.py`
- [Cloud adapters](https://github.com/osteensco/switchboard/blob/main/sdk/py/src/switchboard/cloud.py): `sdk/py/src/switchboard/cloud.py`

### CLI and infrastructure

- [Developer CLI](https://github.com/osteensco/switchboard/tree/main/cli/src/cmd): `cli/src/cmd`
- [Deployment management](https://github.com/osteensco/switchboard/blob/main/cli/src/core/deployer.go): `cli/src/core/deployer.go`
- [Project scaffolding](https://github.com/osteensco/switchboard/blob/main/cli/src/core/scaffolder.go): `cli/src/core/scaffolder.go`
- [Logs and monitoring](https://github.com/osteensco/switchboard/tree/main/cli/src/core): `cli/src/core`
- [AWS infrastructure templates](https://github.com/osteensco/switchboard/tree/main/cli/src/assets/templates/aws): `cli/src/assets/templates/aws`

### Other components

- **Workflow owner**
- **User task functions**

## Connections

- Workflow owner → Workflow trigger: starts run (evidence: `README.md`)
- Workflow trigger → Invocation queue: sends message (evidence: `sdk/py/src/switchboard/response.py`)
- Invocation queue → Workflow engine: invokes (evidence: `README.md`)
- Workflow engine → Database interface: reads and writes (evidence: `sdk/py/src/switchboard/workflow.py`)
- Database interface → Workflow state store: persists state (evidence: `sdk/py/src/switchboard/db.py`)
- Database interface → Cloud adapters: connects through (evidence: `sdk/py/src/switchboard/db.py`)
- Workflow engine → Executor queue: enqueues tasks (evidence: `sdk/py/src/switchboard/workflow.py`)
- Executor queue → Task executor: dispatches (evidence: `README.md`)
- Task executor → User task functions: calls task (evidence: `sdk/py/src/switchboard/executor.py`)
- Task executor → Task response: creates response (evidence: `sdk/py/src/switchboard/executor.py`)
- User task functions → Task response: reports completion (evidence: `README.md`)
- Task response → Queue dispatch: sends response (evidence: `sdk/py/src/switchboard/response.py`)
- Queue dispatch → Database interface: discovers endpoint (evidence: `sdk/py/src/switchboard/invocation.py`)
- Queue dispatch → Cloud adapters: pushes message (evidence: `sdk/py/src/switchboard/invocation.py`)
- Workflow engine → Execution schemas: uses state models (evidence: `sdk/py/src/switchboard/workflow.py`)
- Database interface → Execution schemas: serializes state (evidence: `sdk/py/src/switchboard/db.py`)
- Database interface → Runtime enums: selects resources (evidence: `sdk/py/src/switchboard/db.py`)
- Workflow engine → Runtime enums: tracks step status (evidence: `sdk/py/src/switchboard/workflow.py`)
- Workflow engine → Structured logging: logs execution (evidence: `sdk/py/src/switchboard/workflow.py`)
- Database interface → Structured logging: logs storage activity (evidence: `sdk/py/src/switchboard/db.py`)
- Workflow owner → Developer CLI: manages workflows (evidence: `README.md`)
- Developer CLI → Deployment management: deployment support
- Developer CLI → Project scaffolding: project setup
- Developer CLI → Logs and monitoring: observability support
- Deployment management → AWS infrastructure templates: uses templates
