JavaScript & Python Client SDKs
Relevant source files
The following files were used as context for generating this wiki page:
The JavaScript and Python Client SDKs provide programmatic interfaces for interacting with the superglue API. They allow developers to execute deterministic multi-step workflows ("tools"), manage systems, and retrieve execution results directly from application code. These SDKs are optimized for use in product logic, backend jobs, and request handlers where deterministic integration execution is required.
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:65-74, packages/sdk/js/package.json
SDK Architecture and Generation
The SDKs are generated from the superglue OpenAPI specification. This ensures that the client libraries remain synchronized with the core REST API.
Generation Process
- Python SDK: Generated using
openapi-python-client. The generation script flattens the output structure and adds aSuperglueClientalias to theAuthenticatedClientfor improved developer experience. - JavaScript/TypeScript SDK: Generated using
orval. It targets TypeScript to provide type safety for API requests and responses.
This diagram shows how the OpenAPI specification serves as the single source of truth for both SDKs.
Sources: packages/sdk/scripts/generate-python-sdk.sh:10-50, packages/sdk/js/package.json:14-15
Python Client SDK
The Python SDK (superglue-client) supports both synchronous and asynchronous execution patterns. It uses httpx as the underlying transport layer, allowing for advanced customizations like event hooks.
Client Initialization
Users can initialize a basic Client for public endpoints or a SuperglueClient for endpoints requiring authentication via an API token.
| Component | Description |
|---|---|
Client | Base client for unauthenticated requests. |
SuperglueClient | Authenticated client using a Bearer token. |
verify_ssl | Parameter to specify CA bundles or disable SSL verification. |
Sources: packages/sdk/python/README.md:5-56
Execution Patterns
Each API path/method combination is mapped to a module containing four primary functions:
| Function | Type | Return Value |
|---|---|---|
sync | Blocking | Parsed data or None |
sync_detailed | Blocking | Response object with status code and metadata |
asyncio | Async | Parsed data or None |
asyncio_detailed | Async | Response object with status code and metadata |
Sources: packages/sdk/python/README.md:60-70
Python Implementation Example
from superglue_client import SuperglueClient
from superglue_client.api.tools import run_tool
client = SuperglueClient(base_url="https://api.superglue.cloud", token="YOUR_API_KEY")
with client as client:
response = run_tool.sync_detailed(
client=client,
tool_id="my-tool-id",
json_body={"input_key": "value"}
)
Sources: packages/sdk/python/README.md:15-25
JavaScript/TypeScript Client SDK
The JavaScript SDK (@superglue/client) is a TypeScript-native library. It provides types for tool configurations, step results, and system definitions.
Key Features
- Type Safety: Provides interfaces for
Tool,System,Run, andStoredRunResults. - Module Support: Shipped as an ES Module (
type: "module"). - Tool Execution: Allows triggering saved tools and passing payloads.
Sources: packages/sdk/js/package.json, packages/web/src/lib/agent/skills/content/superglue-concepts.md:65-71
Deployment and Integration Patterns
The SDKs facilitate the "API + SDK" deployment pattern. In this model, the superglue platform acts as the execution engine while the SDK handles the communication.
This diagram illustrates the flow of a tool execution request through the SDK.
Integration Workflow
- Build: Define and save a tool in the superglue web interface.
- Configure: Install the SDK in the application environment (e.g.,
pip install superglue-clientornpm install @superglue/client). - Invoke: Pass the
toolIdand a JSONpayloadto the SDK's execution function. - Process: Receive a deterministic result for use in application logic.
Sources: packages/web/src/lib/agent/skills/content/superglue-concepts.md:65-80, packages/sdk/python/README.md:104-110
Package Management
Both SDKs follow standard versioning and publishing workflows.
- Python Publishing: Uses
Poetryfor dependency management andtwinefor uploading to PyPI. Versioning is handled viapatch,minor, ormajorarguments. - JavaScript Publishing: Uses
npmwith dedicated scripts for version increments.
Sources: packages/sdk/scripts/publish-sdk-python.sh:65-85, packages/sdk/js/package.json:16-18
The JavaScript and Python SDKs enable seamless integration of superglue's deterministic workflows into existing software stacks, providing a bridge between AI-generated configurations and reliable code execution.