Systems & Credentials Management
Relevant source files
The following files were used as context for generating this wiki page:
- packages/web/src/lib/agent/skills/content/systems-handling.md
- packages/web/src/lib/agent/registries/tool-registry.ts
- packages/core/systems/system-manager.ts
- packages/core/datastore/postgres.ts
- packages/web/src/components/systems/context/system-config-context.tsx
- packages/core/api/systems-documentation.ts
- packages/web/src/lib/agent/skills/content/access-rules.md
- packages/web/src/lib/agent/agent-context.ts
Systems are reusable building blocks in superglue that store configuration details and credentials for external services. They provide the necessary connectivity for tools to interact with APIs, databases, and file servers through standardized protocol strategies. The management system ensures that credentials remain secure, environment-specific, and accessible through a namespaced variable syntax during tool execution.
The project utilizes a centralized SystemManager to handle authentication lifecycle events, such as OAuth token refreshing, and documentation ingestion. Systems integrate directly with the RBAC (Role-Based Access Control) layer to enforce permission boundaries on specific endpoints or operations.
System Configuration and Data Model
A System entity encapsulates all metadata required to connect to an external service. This includes the base URL, authentication type, and environment context. The following ER diagram illustrates the relationship between a system and its core attributes.
The data model supports various fields to define service behavior and identity.
| Field | Type | Description |
|---|---|---|
id | String | Unique identifier using lowercase letters, numbers, and underscores only. |
environment | Enum | Defines context as "dev" or "prod". Immutable after creation. |
url | String | Base URL for APIs or connection strings for databases/file servers. |
credentials | JSONB | Encrypted key-value pairs for authentication. |
multiTenancyMode | Enum | Enables or disables merging end-user credentials for shared systems. |
Sources: packages/core/datastore/postgres.ts:166-186, packages/web/src/lib/agent/skills/content/systems-handling.md:120-123
System Knowledge and Templates
Superglue uses "System Knowledge" to auto-populate metadata for known services. This resolution follows a specific order:
templateNamestored on the system.- Direct
system.idlookup. system.idwith numeric suffixes removed.system.namematching.- URL regex matching.
Sources: packages/web/src/lib/agent/skills/content/systems-handling.md:32-44
Credentials and Variables
Credentials are never injected automatically into tool steps. Instead, you must explicitly reference them using a namespaced variable syntax: <<systemId_credentialKey>>. This approach ensures that tools remain environment-agnostic as the system resolves the correct value based on the current execution mode.
Variables are resolved for the following request components:
- HTTP: Headers, query parameters, and the request body.
- Databases: Connection URLs and query parameters.
- Variables:
<<systemId_url>>provides the system's base URL.
Sources: packages/web/src/lib/agent/skills/content/systems-handling.md:14-26, packages/web/src/lib/agent/skills/content/systems-handling.md:152-159
OAuth Authentication Lifecycle
The authenticate_oauth tool manages the initiation of OAuth flows. It requires that client_id and client_secret are already stored within the system's credentials.
Authentication Flow
- Initiation: The agent calls
authenticate_oauthwith required scopes. - User Interaction: The system renders a UI component for the user to complete the flow with the provider.
- Storage: On success, the system automatically saves
access_token,refresh_token, andexpires_at.
Automated Refresh
The SystemManager monitors token expiration. Before any step execution involving an OAuth system, the system checks if the token is expired. If required, it uses the stored refresh_token to obtain a new access_token and updates the datastore automatically.
Sources: packages/core/systems/system-manager.ts:192-225, packages/web/src/lib/agent/registries/tool-registry.ts:983-1025
Environment Management
Systems distinguish between "dev" and "prod" environments to separate sandbox and production credentials. Two systems are "linked" if they share the same id but have different environment values.
Environment Rules
- Immutability: The environment is set at creation and cannot be changed.
- Inheritance: Dev systems automatically inherit documentation from their linked production system if they share the same ID.
- Fallback: During tool execution, the system prefers the environment matching the tool's mode but falls back to production if a development system does not exist.
Sources: packages/core/systems/system-manager.ts:101-120, packages/web/src/lib/agent/skills/content/systems-handling.md:120-143
Documentation and Knowledge Search
Systems ingest documentation through three primary channels to assist the agent in understanding API structures and requirements.
Ingestion Methods
- Scraping: A
documentationUrltriggers a one-time background scrape. - OpenAPI Specs: Providing an
openApiUrlfetches and stores the Swagger/OpenAPI JSON/YAML. - Direct Upload: Users upload files which are stored as
documentationFilesreferences.
Searching Documentation
The search_documentation tool uses keyword matching and scoring to extract relevant sections from ingested content.
The system always appends specificInstructions to search results to ensure special constraints (like rate limits or pagination rules) are prioritized.
Sources: packages/core/systems/system-manager.ts:167-200, packages/core/api/systems-documentation.ts:489-510, packages/web/src/lib/agent/skills/content/systems-handling.md:89-106
Access Control Integration
Credentials and system access are gated by Role-Based Access Control (RBAC). Roles define allowlists for systems with specific access levels.
| Level | Behavior |
|---|---|
read-only | Blocks mutating HTTP methods (POST, PUT, PATCH, DELETE). |
read-write | Allows all supported protocol operations. |
Custom Rule | Evaluates JS expressions against the resolved stepConfig. |
Mutating operations are detected by protocol:
- HTTP: Non-GET/HEAD methods.
- Postgres: Statements containing
INSERT,UPDATE,DELETE,DROP, etc. - Redis: Commands not in the predefined read-only set (e.g.,
SETis blocked).
Sources: packages/web/src/lib/agent/skills/content/access-rules.md:21-35, packages/web/src/lib/agent/skills/content/access-rules.md:52-65
Systems & Credentials Management provides the secure foundation for all superglue integrations. By abstracting connectivity through System entities and namespaced variables, the platform enables deterministic execution across complex, multi-system environments while maintaining strict security and environment separation.