SIM Integration Plugin
The SIM (Sim Studio) integration plugin brings AI-native workflow orchestration to Ever Gauzy, enabling tenants to design, trigger, and monitor AI agent workflows directly from the platform.
Overview
| Property | Value |
|---|---|
| Package | @gauzy/plugin-integration-sim |
| Source | packages/plugins/integration-sim |
| SDK | simstudio-ts-sdk |
| License | AGPL-3.0 |
| Version | 0.1.0 |
1. Introduction
This document describes the architecture and workflow design for integrating SIM (Sim Studio) — an open-source visual workflow builder for AI agent workflows — into the Ever Gauzy multi-tenant SaaS platform. It covers concepts, design decisions, data flows, and schema diagrams to provide a clear mental model of how the integration works.
2. What Is SIM and Why Integrate It?
2.1 What SIM Provides
SIM (Sim Studio) is an open-source platform that allows users to design, build, and deploy AI agent workflows through a visual drag-and-drop canvas. It connects AI models (OpenAI, Anthropic, Google Gemini, and others), databases, APIs, and business tools into orchestrated pipelines. Workflows can be triggered through chat interfaces, REST APIs, webhooks, scheduled cron jobs, or external events.
SIM offers over 80 native integrations, real-time collaboration, and can be deployed either as a managed cloud service or self-hosted via Docker and Kubernetes.
2.2 Why Gauzy Needs SIM
Gauzy already integrates with automation platforms — Zapier, Make, and Activepieces — which are designed for general-purpose workflow automation. SIM fills a different niche: AI-native orchestration. Where Zapier connects apps through triggers and actions, SIM connects AI agents through intelligent pipelines that can reason, branch, loop, and process unstructured data.
By integrating SIM, Gauzy tenants gain the ability to:
- Build AI-powered automation workflows that interact with their Gauzy data
- Execute complex multi-step AI pipelines programmatically from within Gauzy
- Trigger AI workflows from internal Gauzy events such as timer starts, task completions, or employee onboarding
- Monitor workflow execution history and results directly from the Gauzy dashboard
2.3 How SIM Differs from Existing Integrations
| Aspect | Zapier / Make / Activepieces | SIM |
|---|---|---|
| Primary purpose | App-to-app automation | AI agent orchestration |
| Workflow building | Trigger-action chains | Visual block canvas with AI agents, logic, and tools |
| AI capabilities | Limited (single AI step) | Native (multi-agent, reasoning, branching) |
| Authentication | OAuth2 flow | API key |
| Execution model | Event-driven webhooks | SDK-driven programmatic execution |
| Self-hosting | Varies | Fully supported (Docker / Kubernetes) |
3. Integration Approach
3.1 Plugin-Based Architecture
The SIM integration is implemented as a Gauzy plugin, following the same architectural pattern used by the Zapier, Make, and Activepieces integrations. This means it lives as a self-contained package within the plugins directory and registers itself with the Gauzy core through the standard plugin lifecycle.
This approach was chosen for the following reasons:
- Consistency: Every automation integration in Gauzy is a plugin. SIM is no exception.
- Modularity: The plugin can be enabled or disabled per deployment without affecting the core platform.
- Reuse: The plugin leverages all existing core integration infrastructure — tenant management, settings storage, permission guards, event buses — rather than reinventing them.
- Isolation: Plugin code is decoupled from Gauzy core, making it independently testable and maintainable.
3.2 Why Not a Microservice or MCP Extension?
A microservice approach was considered but rejected because SIM integration is fundamentally a client-side operation — Gauzy calls SIM's API. There is no need for a separate runtime process. The SDK handles all communication.
An MCP-only extension was also considered. While SIM workflows will be selectively exposed via MCP (see Section 9), the MCP server is designed for AI assistants to call Gauzy tools, not for Gauzy to orchestrate external platforms. The plugin approach is the correct layer for this integration.
3.3 Architecture Diagram
4. How the Plugin Fits into Gauzy
4.1 Plugin Lifecycle
When Gauzy starts, the SIM plugin goes through the standard plugin lifecycle:
- Registration: The plugin declares its module, entities, and configuration callback
- Bootstrap: The plugin validates that essential configuration is present (environment variables for default SIM URL) and logs its readiness
- Runtime: The module's controllers, services, and event handlers become active and respond to requests
- Destroy: On shutdown, the plugin cleans up any resources (cached clients, etc.)
@Plugin({
imports: [SimModule],
entities: [SimWorkflowExecution],
configuration: (config: ApplicationPluginConfig) => {
return config;
},
})
export class IntegrationSimPlugin
implements IOnPluginBootstrap, IOnPluginDestroy
{
onPluginBootstrap(): void {
console.log("IntegrationSimPlugin is being bootstrapped...");
}
onPluginDestroy(): void {
console.log("IntegrationSimPlugin is being destroyed...");
}
}
4.2 Core Module Dependencies
The SIM plugin does not operate in isolation. It imports and depends on several core Gauzy modules:
- Integration Tenant Module: Manages the per-tenant integration record that links a tenant to their SIM configuration
- Integration Setting Module: Stores and retrieves per-tenant settings like API keys, base URLs, and event-to-workflow mappings
- Integration Module: Manages the base "SIM" integration entry in the integration catalog
- Role Permission Module: Provides guards for permission-based access control
- CQRS Module: Enables the command bus (for creating/updating integration records) and event bus (for listening to internal Gauzy events)
- HTTP Module: Provides HTTP client capabilities (used internally by the SIM SDK)
- Config Module: Access to environment-level configuration
4.3 Contracts Extension
The shared contracts package includes an entry in the integration enumeration to identify SIM as a recognized integration provider. This is a single-line addition to the existing enum that already contains entries for Zapier, Make, Activepieces, GitHub, Jira, and others.
4.4 Component Responsibility Map
| Component | Responsibility |
|---|---|
IntegrationSimPlugin | Entry point; registers the module and entity with the Gauzy plugin system |
SimModule | NestJS module wiring controllers, services, and repositories |
SimController | Handles incoming REST requests (setup, execution, history, status) |
SimService | Core business logic: credential management, workflow execution, event triggers, execution history |
SimClientFactory | Per-tenant SDK client instantiation with caching and concurrency control |
SimRepositoryService | Data access layer for the SimWorkflowExecution entity |
SimWorkflowExecution | Database entity storing execution logs per tenant |
5. Authentication and Credential Management
5.1 How SIM Authentication Works
Unlike Zapier and Make which use OAuth2 with authorization codes, redirect URIs, and token refresh cycles, SIM uses a straightforward API key authentication model. Each SIM user or organization generates an API key from their SIM dashboard, and this key is included with every API request.
This simplifies the integration significantly — there is no OAuth flow to implement, no authorization controller needed, no token refresh logic, and no state parameter management. The tenant simply provides their API key, and the plugin stores it.
5.2 Credential Storage
Credentials are stored using Gauzy's existing IntegrationSetting mechanism, which is a key-value store scoped by tenant and organization. Each tenant's SIM configuration consists of three settings:
| Setting | Purpose |
|---|---|
| API Key | The SIM API key used to authenticate SDK calls |
| Base URL | The SIM instance URL (defaults to the cloud service, can point to a self-hosted instance) |
| Enabled Flag | Whether the integration is active for this tenant |
These settings are stored in the same way Zapier stores its client ID, client secret, and access tokens — as named entries in the integration settings table, linked to the tenant's integration record.
6. Multi-Tenant Isolation
6.1 How Tenant Isolation Is Achieved
Multi-tenancy is a first-class concern in this integration. The isolation model works at four levels:
Level 1 — Request Authentication: Every API request to Gauzy includes a JWT token that identifies the tenant. The TenantPermissionGuard extracts and validates this before any controller logic executes.
Level 2 — Data Scoping: All database queries for integration records, settings, and execution logs include the tenant ID as a filter. A tenant can never read or write another tenant's SIM configuration or execution history.
Level 3 — Client Isolation: The SimClientFactory creates a separate SIM SDK client instance for each tenant, initialized with that tenant's unique API key and base URL. Clients are cached by integration ID, so two tenants with different API keys will always have different client instances.
Level 4 — Execution Isolation: Each workflow execution is logged with the tenant ID and organization ID. Execution results, inputs, and outputs are stored per-tenant and only accessible by that tenant.
6.2 Tenant Isolation Flow
7. How Workflow Execution Works
7.1 Execution Modes
The SIM SDK supports two execution modes, both of which the plugin exposes:
- Synchronous Execution: The caller sends a request and waits for the workflow to complete. The response includes the full output, duration, and execution metadata. Best for short-running workflows (under 30 seconds).
- Asynchronous Execution: The caller sends a request and immediately receives a task ID. The workflow runs in the background on the SIM side. The caller can poll for status using the task ID. Best for long-running workflows or when the caller does not need to wait.
7.2 Synchronous Execution Flow
7.3 Asynchronous Execution Flow
7.4 What Happens Inside SIM
When the SIM SDK sends an execution request, SIM processes it through its internal engine:
- The workflow definition is loaded (blocks, connections, configuration)
- The input data is injected into the entry block
- Each block executes in sequence or parallel depending on the graph structure
- AI agent blocks call their configured AI models (OpenAI, Anthropic, etc.)
- Logic blocks evaluate conditions and route data accordingly
- Output blocks collect the final results
- The result is returned to the caller (or stored for async polling)
Gauzy does not need to know the internal details of SIM's execution engine. The plugin treats SIM as a black box: send input, receive output.
8. Event-Driven Workflow Triggers
8.1 Concept
Beyond manual and API-driven execution, the SIM plugin can automatically trigger workflows in response to internal Gauzy events. This is the same pattern used by the Zapier integration, where Zapier webhooks are notified when a timer starts or stops.
The difference is that instead of posting to a webhook URL, the SIM plugin directly executes a SIM workflow using the SDK.
8.2 Event-to-Workflow Mapping
Tenants can configure mappings between Gauzy events and SIM workflow IDs. These mappings are stored as integration settings:
| Event Name | Mapped Workflow ID | Description |
|---|---|---|
timer.started | wf-abc-123 | Triggered when an employee starts their timer |
timer.stopped | wf-def-456 | Triggered when an employee stops their timer |
task.completed | wf-ghi-789 | Triggered when a task is marked complete |
When a Gauzy domain event fires, the plugin's event handler checks if the tenant has SIM enabled and if there is a workflow mapped to that event. If so, it executes the workflow asynchronously with the event data as input.
8.3 Event-Driven Flow
8.4 Important Design Decisions
- Event-driven execution is always asynchronous — it must not block the original Gauzy event processing
- If the SIM integration is not configured for a tenant, the event handler silently returns without error
- If no workflow is mapped to the event, the handler silently returns
- Errors in SIM execution are logged but do not propagate back to the event source
- This is an opt-in feature — tenants must explicitly configure event-to-workflow mappings
9. How SIM and the MCP Server Coexist
9.1 Different Purposes, Complementary Roles
Gauzy already has an MCP (Model Context Protocol) server that exposes Gauzy's data and actions as tools for AI assistants. The MCP server and SIM integration serve fundamentally different purposes:
- MCP Server: Enables "AI-into-Gauzy" — AI assistants use Gauzy tools
- SIM Integration: Enables "Gauzy-into-AI" — Gauzy triggers complex AI pipelines
- Integration Point: Selected SIM workflows can be exposed as MCP tools, allowing an AI assistant to trigger a complex SIM pipeline during a chat
9.2 The Decision Matrix
Use MCP when: A single, discrete action is needed. "Get my tasks." "Start a timer." "Create an invoice." These are direct data operations that the MCP server handles efficiently.
Use SIM when: A complex, multi-step pipeline is needed. "Analyze all employee timesheets for the quarter, generate a summary report, identify anomalies, and email the results to the HR manager." This requires chaining multiple AI agents with business logic — exactly what SIM excels at.
9.3 Optional MCP Bridge
As an advanced feature, selected SIM workflows can be exposed as MCP tools. This allows AI assistants to trigger complex SIM workflows through the MCP protocol. The MCP server would include a tool that calls the SIM plugin's execution endpoint, bridging the two systems.
This is optional and should be implemented only after the core plugin is stable.
10. Execution Logging and Audit Trail
10.1 What Gets Logged
Every workflow execution — whether manual, API-driven, or event-triggered — is recorded in a dedicated execution log. Each log entry captures:
- Workflow ID: Which SIM workflow was executed
- Execution ID: SIM's internal execution identifier (for cross-referencing with SIM's own logs)
- Status: The execution outcome —
queued,processing,completed,failed, orcancelled - Input: The data sent to the workflow (sanitized to remove any sensitive information)
- Output: The result returned by the workflow
- Error: If the execution failed, the error details
- Duration: How long the execution took in milliseconds
- Triggered By: What initiated the execution —
manual(user action),event(Gauzy domain event),api(programmatic call), orschedule(cron-based) - Tenant and Organization: Standard multi-tenancy scoping