Runtime SDKs
The Swytchcode Runtime SDKs allow you to execute trusted tools directly from your application without interacting with the CLI manually.
Whether you’re building an AI agent, backend service, workflow automation, or developer tool, the Runtime SDK provides a simple API for executing tools while letting Swytchcode handle authentication, policies, retries, and API execution.
Instead of writing provider-specific SDK code, you simply execute a trusted tool.
Under the hood, the SDK doesn’t reimplement any of this logic - it calls into the same execution engine that powers swy exec from the CLI. As the CLI overview puts it: “even if you’re building a custom AI application with the JavaScript or Python Runtime SDK, the CLI remains the underlying execution engine.” Your project’s tooling.json, manifest.json, and policies.json are read the same way regardless of whether the request came from a terminal command, an MCP client, or a line of application code.
Why Runtime SDKs?
Without a runtime SDK, applications typically need to:
- Build HTTP requests manually
- Manage API authentication
- Handle retries and timeouts
- Implement idempotency
- Validate request inputs
- Execute provider-specific SDKs
- Handle provider-specific error responses
The Runtime SDK removes this complexity by delegating execution to the Swytchcode runtime.
Your Application │ ▼Runtime SDK │ ▼Swytchcode Runtime │ ▼Provider APIThis provides a consistent execution model regardless of which provider your application interacts with.
How It Works
Every SDK follows the same execution pipeline.
Application │ ▼Execute Tool │ ▼Input Validation │ ▼Policy Evaluation │ ▼Authentication │ ▼Execution Policy │ ▼Provider API │ ▼Return ResponseThe Runtime SDK is responsible for invoking the Swytchcode runtime, while the runtime itself performs validation, authentication, policy evaluation, retries, and API execution. This is the same execution path documented in the CLI’s Execution lifecycle - the SDK is a language-native entry point into it, not a separate implementation.
Supported Runtime SDKs
Swytchcode currently provides Runtime SDKs for the following languages.
| SDK | Status |
|---|---|
| JavaScript | ✅ Supported |
| Python | ✅ Supported |
| Go | 🚧 Coming Soon |
Each SDK exposes an idiomatic interface for its language while sharing the same execution model.
The runtime SDK documentation includes separate guides for JavaScript runtime and Python runtime, as well as the shared Execution Pipeline guide.
Common Features
Every Runtime SDK includes the same core capabilities.
Execute Trusted Tools
Execute any method or workflow that has been enabled in your project. See the Execution Pipeline for examples and best practices.
Automatic Authentication
Provider credentials are resolved automatically before execution.
No additional authentication logic is required in your application. See Managed Authentication to learn how credentials are resolved and stored.
Policy Enforcement
Every request is evaluated against your project’s policies before reaching the provider. Learn how policies protect execution in Policies & Guardrails.
Production-Ready Execution
Execution policies defined in manifest.json are applied automatically, including:
- Retries
- Timeouts
- Idempotency
- Concurrency limits
Consistent Responses
The runtime normalizes responses and errors, providing a predictable developer experience across different providers.
When Should You Use the Runtime SDK?
The Runtime SDK is ideal for:
- AI agents
- Backend services
- Serverless functions
- Internal developer tools
- Workflow automation
- Production applications
If your application needs to execute Swytchcode tools programmatically, the Runtime SDK is the recommended integration.
Runtime SDK vs CLI
Both interfaces execute through the same CLI-powered engine - the SDK doesn’t bypass the CLI, it calls into the same code path that swy exec uses.
| Runtime SDK | CLI |
|---|---|
| Embedded inside your application | Used from the terminal |
| Language-native API | Command-line interface |
| Best for production applications | Best for development and automation |
| Executes tools programmatically | Executes tools manually |
Regardless of how execution begins, every request follows the same execution pipeline, reads the same tooling.json/manifest.json/policies.json project state, and is subject to the same policies.
Runtime Architecture
Your Application │ ┌───────────┴───────────┐ │ │ ▼ ▼ JavaScript SDK Python SDK │ │ └───────────┬───────────┘ │ ▼ Swytchcode Runtime │ ┌────────────────┼────────────────┐ │ │ │ ▼ ▼ ▼ Authentication Policies Execution Policy │ ▼ Provider APIsThis shared architecture ensures consistent behavior across every supported language.
Choosing a Runtime
Choose the SDK that matches your application.
- JavaScript SDK - Recommended for Node.js, Bun, Next.js, and serverless applications.
- Python SDK - Recommended for AI agents, automation, data pipelines, and backend services.
Regardless of the language, every Runtime SDK executes tools using the same Swytchcode runtime.
Continue with:
Next Steps
JavaScript SDK
Learn how to install and use the runtime in Node.js applications.
Python SDK
Execute Swytchcode tools from Python.
Execution Pipeline
Understand how requests flow through validation, authentication, policies, and execution.
Authentication
Learn how credentials are resolved automatically when the runtime executes tools.