Deploy

View as MarkdownOpen in Claude

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

EnvironmentOptions
Developmentagent.run() on localhost, ngrok for public testing, auto-reload on changes
ProductionUvicorn with workers, HTTPS with certificates, load balancing, health monitoring
ServerlessAWS Lambda, Google Cloud Functions, Azure Functions, auto-scaling, pay per invocation
ContainerDocker, Kubernetes, auto-scaling, rolling updates, service mesh
TraditionalCGI mode, Apache/nginx integration, shared hosting compatible

Environment detection

The SDK automatically detects your deployment environment:

Environment VariableDetected Mode
GATEWAY_INTERFACECGI mode
AWS_LAMBDA_FUNCTION_NAMEAWS Lambda
LAMBDA_TASK_ROOTAWS Lambda
FUNCTION_TARGETGoogle Cloud Functions
K_SERVICEGoogle Cloud Functions
GOOGLE_CLOUD_PROJECTGoogle Cloud Functions
AZURE_FUNCTIONS_ENVIRONMENTAzure Functions
FUNCTIONS_WORKER_RUNTIMEAzure Functions
(none of above)Server mode (default)

Chapter contents

SectionDescription
Local DevelopmentDevelopment server and testing
ProductionProduction server deployment
ServerlessLambda, Cloud Functions, Azure
Docker & KubernetesContainer deployment
CGI ModeTraditional CGI deployment

Quick start

1#!/usr/bin/env python3
2from signalwire import AgentBase
3
4class MyAgent(AgentBase):
5 def __init__(self):
6 super().__init__(name="my-agent")
7 self.add_language("English", "en-US", "rime.spore")
8 self.prompt_add_section("Role", "You are a helpful assistant.")
9
10if __name__ == "__main__":
11 agent = MyAgent()
12 agent.run()

The run() method automatically:

  • Detects serverless environments (Lambda, Cloud Functions, Azure)
  • Starts a development server on localhost for local development
  • Handles CGI mode when deployed to traditional web servers

Starting the development server

The simplest way to run your agent locally:

LanguageRun Command
Pythonpython my_agent.py
TypeScriptnpx ts-node my_agent.ts or node my_agent.js

All languages default to http://localhost:3000.