# 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](/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.

```text
Your Application
        │
        ▼
Runtime SDK
        │
        ▼
Swytchcode Runtime
        │
        ▼
Provider API
```

This provides a consistent execution model regardless of which provider your application interacts with.

---

## How It Works

Every SDK follows the same execution pipeline.

```text
Application
      │
      ▼
Execute Tool
      │
      ▼
Input Validation
      │
      ▼
Policy Evaluation
      │
      ▼
Authentication
      │
      ▼
Execution Policy
      │
      ▼
Provider API
      │
      ▼
Return Response
```

The 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](/cli/exec/#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.

- [JavaScript runtime GitHub](https://github.com/swytchcodehq/runtime-js)
- [Python runtime GitHub](https://github.com/swytchcodehq/runtime-py)

The runtime SDK documentation includes separate guides for [JavaScript runtime](/runtime-sdk/javascript/) and [Python runtime](/runtime-sdk/python/), as well as the shared [Execution Pipeline](/guides/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](/guides/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](/guides/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](/policies/overview/).

---

#### Production-Ready Execution

Execution policies defined in [manifest.json](/configuration/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

```text
                  Your Application
                         │
             ┌───────────┴───────────┐
             │                       │
             ▼                       ▼
     JavaScript SDK           Python SDK
             │                       │
             └───────────┬───────────┘
                         │
                         ▼
                Swytchcode Runtime
                         │
        ┌────────────────┼────────────────┐
        │                │                │
        ▼                ▼                ▼
   Authentication   Policies      Execution Policy
                         │
                         ▼
                    Provider APIs
```

This 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](https://docs.swytchcode.com/runtime-sdk/javascript/) - Learn how to install and use the runtime in Node.js applications.
- [Python SDK](https://docs.swytchcode.com/runtime-sdk/python/) - Execute Swytchcode tools from Python.
- [Execution Pipeline](https://docs.swytchcode.com/guides/execution-pipeline/) - Understand how requests flow through validation, authentication, policies, and execution.
- [Authentication](https://docs.swytchcode.com/guides/authentication/) - Learn how credentials are resolved automatically when the runtime executes tools.
