The Semantic Workbench service consists of several key components that interact to provide a seamless user experience:
Workbench Service: A backend Python service that handles state management, user interactions, conversation history, file storage, and real-time event distribution.
Workbench App: A single-page web application written in TypeScript and React that provides the user interface for interacting with assistants.
FastAPI Framework: Powers the HTTP API and Server-Sent Events (SSE) for real-time updates between clients and assistants.
Database Layer: Uses SQLModel (SQLAlchemy) with support for both SQLite (development) and PostgreSQL (production) for persistent storage.
Authentication: Integrated Azure AD/Microsoft authentication with JWT token validation.
Assistants: Independently developed services that connect to the Workbench through a RESTful API, enabling AI capabilities.
- Controller Layer: Implements business logic for conversations, assistants, files, and users
- Database Models: SQLModel-based entities for storing application state
- Authentication: Azure AD integration with JWT validation
- File Storage: Versioned file system for conversation attachments and artifacts
- Event System: Real-time event distribution using Server-Sent Events (SSE)
- API Layer: RESTful endpoints for all service operations
The communication between the Workbench and Assistants is managed through multiple channels:
- HTTP API: RESTful endpoints for CRUD operations and state management
- Server-Sent Events (SSE): Real-time event streaming for immediate updates
- Event System: Structured event types (e.g.,
message.created
,conversation.updated
) for real-time state synchronization - Webhook Callbacks: Assistant registration with callback URLs for event delivery
The service uses SQLModel to manage structured data:
- Users: Authentication and profile information
- Conversations: Messaging history and metadata
- Messages: Different message types with content and metadata
- Participants: Users and assistants in conversations
- Files: Versioned attachments for conversations
- Assistants: Registered assistants and their configurations
- Shares: Conversation sharing capabilities
- Create, update, and delete conversations
- Add and remove participants
- Different message types (chat, note, notice, command)
- Message metadata and debug information
- File attachment support
- Versioned file storage
- Multiple content types
- Share conversations with other users
- Public/private share links
- Share redemption
- Assistant registration and discovery
- API key management for secure communication
- Event-based communication
- Azure Speech integration for text-to-speech
The service is configured through environment variables:
# Basic configuration
WORKBENCH_SERVICE_HOST=127.0.0.1
WORKBENCH_SERVICE_PORT=5000
# Database settings
WORKBENCH_SERVICE_DB_CONNECTION=sqlite+aiosqlite:///./workbench-service.db
# Or for PostgreSQL:
# WORKBENCH_SERVICE_DB_CONNECTION=postgresql+asyncpg://user:pass@host:port/dbname
# Authentication
WORKBENCH_SERVICE_TENANT_ID=your-azure-tenant-id
WORKBENCH_SERVICE_CLIENT_ID=your-client-id
# File storage
WORKBENCH_SERVICE_FILES_DIR=./.data/files
See the environment setup guide for complete configuration options.
- Python 3.11+
- Access to database (SQLite for development, PostgreSQL for production)
- Azure AD application registration (for authentication)
In the workbench-service directory:
make
This will use uv to install all Python dependencies.
If this fails in Windows, try running a vanilla instance of cmd
or powershell
and not within Cmder
or another shell that may have modified the environment.
The service uses Alembic for database migrations:
# Initialize the database
uv run alembic upgrade head
To run and/or debug in VS Code:
- Open the workspace file
semantic-workbench.code-workspace
- View->Run
- Select "service: semantic-workbench-service"
In the workbench-service directory:
uv run start-service [--host HOST] [--port PORT]
uv run pytest
When running the service, access the FastAPI auto-generated documentation at:
- Swagger UI:
http://localhost:5000/docs
- ReDoc:
http://localhost:5000/redoc
- Database connection errors: Verify your connection string and database permissions
- Authentication failures: Check your Azure AD configuration and client IDs
- File storage permissions: Ensure the service has write access to the files directory
Enable debug logging for more detailed information:
WORKBENCH_SERVICE_LOG_LEVEL=DEBUG uv run start-service