System Architecture Overview
Relevant source files
The following files were used as context for generating this wiki page:
superglue is an AI-native integration platform that enables the creation and execution of deterministic multi-step workflows known as "tools". These tools connect various external resources, including APIs, databases, and file servers, by utilizing a system-management layer that handles authentication, documentation ingestion, and environment-specific configurations.
The architecture separates the AI-driven tool building process from the deterministic execution engine. AI agents assist users in configuring "Systems" (external integrations) and "Tools" (workflows), while the core server manages the persistence, execution, and monitoring of these resources through a structured API and worker pool system.
Sources: packages/web/src/lib/agent/agent-prompts.ts:182-185, CLAUDE.md:12-16
Core Components and Services
The superglue platform consists of three primary layers: the Web Client, the Core API Server, and the Execution Layer.
Application Layers
| Layer | Component | Responsibility |
|---|---|---|
| Interface | Web Client (Port 3001) | Provides the Tool Playground, System Editor, and AI Agent chat interface. |
| Orchestration | Core API (Port 3002) | Manages authentication, resource persistence (Datastore), and dispatches tasks. |
| Execution | Worker Pools | Executes CPU-intensive tasks like tool runs and documentation scraping. |
Sources: CLAUDE.md:8-10, CLAUDE.md:88-90
System Management
SystemManager coordinates interactions with external integrations. It handles documentation loading, OAuth token refreshing, and credential enrichment from templates.
The SystemManager retrieves system configurations and manages the "Dev" vs "Prod" environment logic, where development systems can inherit documentation from production counterparts.
Sources: packages/core/systems/system-manager.ts:25-50, packages/core/systems/system-manager.ts:102-120
Documentation and Knowledge Base
superglue builds a knowledge base for every system to assist the AI agent in tool construction. This system ingests data through three primary methods: URL scraping, OpenAPI specification fetching, and manual file uploads.
Ingestion Flow
- Scrape Job: A background worker crawls a provided URL to extract text content.
- OpenAPI Fetch: The system retrieves JSON or YAML specifications and stores them as file references.
- Documentation Search: A keyword-based scoring algorithm extracts relevant sections from the stored content to provide context for the AI.
AI Agent and Tool Registry
The AI Agent facilitates the "Ideal User Flow" by leveraging a set of specialized tools defined in the TOOL_REGISTRY. The agent uses these tools to discover existing configurations, build new workflows, and debug failures.
Tool Execution Lifecycle
When an agent or user triggers a tool, the platform follows a structured execution path:
- Validation: The system validates the tool structure and input schema.
- Resolution: Credential placeholders (e.g.,
<<systemId_apiKey>>) are resolved from the Datastore. - Execution: The
run_toolcommand executes the tool steps deterministically. - Output: Results are transformed via an optional JavaScript
outputTransform.
Sources: packages/web/src/lib/agent/registries/tool-registry.ts:182-210, packages/web/src/lib/agent/agent-prompts.ts:10-25
Registry Tool Sets
| Tool Set | Included Tools | Purpose |
|---|---|---|
| Base Tools | load_skill, find_tool, run_tool, get_runs | General navigation and execution. |
| Building | build_tool, save_tool | Creation of new tool configurations. |
| Systems | create_system, authenticate_oauth, call_system | Integration management and testing. |
Sources: packages/web/src/lib/agent/registries/tool-registry.ts:1195-1215
Execution Model and Multi-Tenancy
superglue supports different execution environments and multi-tenancy modes.
Environment Handling
Systems are tagged as dev or prod. Tools reference systems by ID, and the platform selects the appropriate system based on the current execution mode. If a dev system is missing, the platform falls back to the prod version.
Sources: packages/core/systems/system-manager.ts:311-330, packages/web/src/lib/agent/skills/content/systems-handling.md:144-155
Multi-Tenancy Sequence
In Enterprise Edition, multi-tenancy allows the platform to merge end-user credentials over the base system configuration during execution.
Summary
The superglue architecture is a robust framework designed to bridge the gap between AI flexibility and deterministic execution. By centralizing integration details into "Systems" and logic into "Tools," the platform provides a scalable environment for managing complex workflows across multiple environments and tenants. Key architectural features include automated documentation ingestion for AI context, a structured registry for agent-accessible tools, and a secure multi-tenancy model for enterprise deployments.
Sources: packages/web/src/lib/agent/agent-prompts.ts:182-190, packages/core/systems/system-manager.ts:347-365