> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # Deploy ## Docs - [CGI Mode](https://signalwire.com/docs/server-sdks/guides/cgi-mode.md): Deploy agents as CGI scripts on traditional web servers like Apache or nginx with automatic environment detection. - [Docker & Kubernetes](https://signalwire.com/docs/server-sdks/guides/docker-kubernetes.md): Containerize your agents with Docker and deploy to Kubernetes for scalable, manageable production deployments. - [Local Development](https://signalwire.com/docs/server-sdks/guides/local-development.md): Run and test SignalWire SDK agents locally during development with hot reloading, tunneling, and debug tools. - [Production Deployment](https://signalwire.com/docs/server-sdks/guides/production.md): Deploy agents to production with SSL, authentication, monitoring, and scaling using uvicorn workers, nginx reverse proxy, and systemd. - [Serverless Deployment](https://signalwire.com/docs/server-sdks/guides/serverless.md): Deploy agents to AWS Lambda, Google Cloud Functions, or Azure Functions with automatic environment detection. > **Note:** This page contains both a page directory (above) and the landing page content (below). The page directory is generated for agent use and does not appear on the landing page. > Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # Deploy > Deploy your agents as local servers, production services, or serverless functions. [local-development]: /docs/server-sdks/guides/local-development [production]: /docs/server-sdks/guides/production [serverless]: /docs/server-sdks/guides/serverless [docker-kubernetes]: /docs/server-sdks/guides/docker-kubernetes [cgi-mode]: /docs/server-sdks/guides/cgi-mode This chapter covers deployment options from development to production. ## What you'll learn 1. **Local Development** - Running agents during development 2. **Production** - Deploying to production servers 3. **Serverless** - AWS Lambda, Google Cloud Functions, Azure Functions 4. **Docker & Kubernetes** - Container-based deployment 5. **CGI Mode** - Traditional web server deployment ## Deployment options overview | Environment | Options | | --------------- | ------------------------------------------------------------------------------------- | | **Development** | `agent.run()` on localhost, ngrok for public testing, auto-reload on changes | | **Production** | Uvicorn with workers, HTTPS with certificates, load balancing, health monitoring | | **Serverless** | AWS Lambda, Google Cloud Functions, Azure Functions, auto-scaling, pay per invocation | | **Container** | Docker, Kubernetes, auto-scaling, rolling updates, service mesh | | **Traditional** | CGI mode, Apache/nginx integration, shared hosting compatible | ## Environment detection The SDK automatically detects your deployment environment: | Environment Variable | Detected Mode | | ----------------------------- | ---------------------- | | `GATEWAY_INTERFACE` | CGI mode | | `AWS_LAMBDA_FUNCTION_NAME` | AWS Lambda | | `LAMBDA_TASK_ROOT` | AWS Lambda | | `FUNCTION_TARGET` | Google Cloud Functions | | `K_SERVICE` | Google Cloud Functions | | `GOOGLE_CLOUD_PROJECT` | Google Cloud Functions | | `AZURE_FUNCTIONS_ENVIRONMENT` | Azure Functions | | `FUNCTIONS_WORKER_RUNTIME` | Azure Functions | | (none of above) | Server mode (default) | ## Chapter contents | Section | Description | | ---------------------------------------- | ------------------------------ | | [Local Development][local-development] | Development server and testing | | [Production][production] | Production server deployment | | [Serverless][serverless] | Lambda, Cloud Functions, Azure | | [Docker & Kubernetes][docker-kubernetes] | Container deployment | | [CGI Mode][cgi-mode] | Traditional CGI deployment | ## Quick start #### Python ```python #!/usr/bin/env python3 from signalwire import AgentBase class MyAgent(AgentBase): def __init__(self): super().__init__(name="my-agent") self.add_language("English", "en-US", "rime.spore") self.prompt_add_section("Role", "You are a helpful assistant.") if __name__ == "__main__": agent = MyAgent() agent.run() ``` #### TypeScript ```typescript import { AgentBase } from '@signalwire/sdk'; const agent = new AgentBase({ name: 'my-agent' }); agent.addLanguage({ name: 'English', code: 'en-US', voice: 'rime.spore' }); agent.promptAddSection('Role', { body: 'You are a helpful assistant.' }); agent.run(); ``` The `run()` method automatically: * Detects serverless environments (Lambda, Cloud Functions, Azure) **(Python only)** * Starts a development server on localhost for local development * Handles CGI mode when deployed to traditional web servers **(Python only)** > **Note** > > In TypeScript, `run()` is an alias for `serve()` and only starts an HTTP server. > For serverless deployments (Lambda, Cloud Functions, Azure, CGI) call > `agent.runServerless(event, context, platform?)` from your platform handler, > or use the `ServerlessAdapter.createLambdaHandler` / `createGcfHandler` / > `createAzureHandler` helpers. See the [Serverless](/docs/server-sdks/guides/serverless) guide. The SignalWire TypeScript SDK (`@signalwire/sdk`) is ESM-only. Your `package.json` must set `"type": "module"`, or your entry file must be named `.mjs`. Otherwise Node will try to load it as CommonJS and imports will fail. ## Starting the development server The simplest way to run your agent locally: | Language | Run Command | | ---------- | -------------------------------------------- | | Python | `python my_agent.py` | | TypeScript | `npx tsx my_agent.ts` or `node my_agent.mjs` | All languages default to `http://localhost:3000`.