Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

update config

Ahmed Essamfec77af60a1a
diff --git a/.env.compose.example b/.env.compose.example
index 50917135..677c0281 100644
--- a/.env.compose.example
+++ b/.env.compose.example
@@ -11,14 +11,13 @@ DATABASE_NAME=smythos-local
# Expansion to build the database url (this entry is MANDATORY for Prisma to work)
DATABASE_URL="$DATABASE_PROVIDER://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST:3306/$DATABASE_NAME?allowPublicKeyRetrieval=true&useSSL=false"
-
APP_DOMAIN="localhost"
-RUNTIME_DOMAIN="runtime.localhost"
+APP_URL="http://$APP_DOMAIN" # Expansion of the APP_DOMAIN variable
+RUNTIME_URL="http://runtime.localhost"
DEFAULT_AGENT_DOMAIN="default.localhost"
PROD_AGENT_DOMAIN="prod.localhost"
MIDDLEWARE_API_PORT="5000"
-APP_DEV_SERVER_PORT="4001"
RUNTIME_PORT="5053"
APP_PORT="5050"
OPENAI_API_KEY="openai-api-key"
diff --git a/.env.example b/.env.example
index ad2679ff..85674f24 100644
--- a/.env.example
+++ b/.env.example
@@ -12,14 +12,17 @@ DATABASE_NAME=smythos_db
DATABASE_URL="$DATABASE_PROVIDER://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOST:3306/$DATABASE_NAME?allowPublicKeyRetrieval=true&useSSL=false"
-APP_DOMAIN="localhost"
-RUNTIME_DOMAIN="runtime.localhost"
-DEFAULT_AGENT_DOMAIN="default.localhost"
-PROD_AGENT_DOMAIN="prod.localhost"
+APP_URL="http://localhost:5050"
+RUNTIME_URL="http://localhost:5053"
+DEFAULT_AGENT_DOMAIN="staging.localagent.ai"
+PROD_AGENT_DOMAIN="live.localagent.ai"
+AGENT_DOMAIN_PORT="5053" # only set when running the app on a port diff than 80/443
-MIDDLEWARE_API_PORT="5000"
-APP_DEV_SERVER_PORT="4001"
-RUNTIME_PORT="5053"
+# App local ports to listen on
APP_PORT="5050"
-OPENAI_API_KEY="openai-api-key"
+RUNTIME_PORT="5053"
+APP_DEV_SERVER_PORT="5051"
+MIDDLEWARE_API_PORT="5000"
+
+OPENAI_API_KEY="openai-api-key"
\ No newline at end of file
diff --git a/.env.full.example b/.env.full.example
index 3cd27edb..1da53f6e 100644
--- a/.env.full.example
+++ b/.env.full.example
@@ -4,8 +4,8 @@
# domain for UI server (used by Traefik reverse proxy)
# example: app.yourdomain.com or localhost (for local development)
-# if empty, defaults to localhost and routes to port 5050
-APP_DOMAIN=
+# if empty, defaults to http://localhost and routes to port 5050
+APP_URL=
# port for UI server (internal port, proxied by Traefik)
APP_PORT=
# vite dev server (react hot reload)
@@ -69,9 +69,9 @@ RUNTIME_ADMIN_PORT=
# All domains below route to the runtime server (port 5053) via Traefik reverse proxy
# Runtime domain (used by Traefik reverse proxy)
-# example: runtime.yourdomain.com or runtime.localhost (for local development)
-# if empty, defaults to runtime.localhost and routes to port 5053
-RUNTIME_DOMAIN=
+# example: http://runtime.yourdomain.com or http://runtime.localhost (for local development)
+# if empty, defaults to http://runtime.localhost and routes to port 5053
+RUNTIME_URL=
# domain that hosts development agents. aka the agent state that is visible in canvas (see https://smythos.com/docs/agent-deployments/overview/)
# example: dev.yourdomain.com or default.localhost (for local development)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b42c2201..8fa9acc9 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -157,6 +157,34 @@ To start in production mode:
pnpm start
```
+### Configuring Embodiment Subdomains (Required)
+
+For embodiment functionality to work properly, you need to configure local subdomains to point to loopback:
+
+> **⚠️ Critical for Embodiments**: These subdomains are necessary for agent embodiments to function correctly during development.
+
+**Add to your hosts file:**
+
+**Linux/macOS:**
+```bash
+sudo sh -c 'echo "127.0.0.1 staging.localagent.ai live.localagent.ai" >> /etc/hosts'
+```
+
+**Windows (run as Administrator):**
+```cmd
+echo 127.0.0.1 staging.localagent.ai live.localagent.ai >> C:\Windows\System32\drivers\etc\hosts
+```
+
+**Verify the configuration:**
+```bash
+# Test that the subdomains resolve to localhost
+ping staging.localagent.ai
+ping live.localagent.ai
+# Both should show 127.0.0.1
+```
+
+> 💡 **Note**: Without these subdomain configurations, agent embodiments will not be able to communicate properly with the runtime server during development.
+
## Development Workflow
### Basic Development Process
diff --git a/DOCKER.md b/DOCKER.md
index 1390fd76..2c51ada4 100644
--- a/DOCKER.md
+++ b/DOCKER.md
@@ -74,8 +74,8 @@ docker-compose logs -f
Once all services are healthy:
-- **Main Application**: http://localhost (or your configured APP_DOMAIN)
-- **Runtime Server**: http://runtime.localhost (or your configured RUNTIME_DOMAIN)
+- **Main Application**: http://localhost (or your configured APP_URL)
+- **Runtime Server**: http://runtime.localhost (or your configured RUNTIME_URL)
> **⚠️ Localhost Subdomain Issue**: Only applies when using the default localhost domain configuration. Some operating systems don't automatically route `*.localhost` subdomains to the loopback address. If you can't access the subdomain URLs above, add them to your hosts file:
>
@@ -175,10 +175,10 @@ For production deployments with custom domains:
```env
# Your main application domain
-APP_DOMAIN=app.yourdomain.com
+APP_URL=http://app.yourdomain.com
# Runtime/API domain
-RUNTIME_DOMAIN=runtime.yourdomain.com
+RUNTIME_URL=http://runtime.yourdomain.com
# Production agents domain
PROD_AGENT_DOMAIN=agents.yourdomain.com
@@ -195,8 +195,8 @@ The docker-compose setup includes automatic SSL certificate generation via Let's
1. **Configure your domains** in `.env`:
```env
- APP_DOMAIN=yourdomain.com
- RUNTIME_DOMAIN=runtime.yourdomain.com
+ APP_URL=http://yourdomain.com
+ RUNTIME_URL=http://runtime.yourdomain.com
```
diff --git a/docker-compose.yml b/docker-compose.yml
index 499f6996..aca83787 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -131,8 +131,8 @@ services:
labels:
- traefik.enable=true
- # APP_DOMAIN routing to port 5050 (UI Server)
- - "traefik.http.routers.smythos-app.rule=Host(`${APP_DOMAIN:-localhost}`)"
+ # APP_URL routing to port 5050 (UI Server)
+ - "traefik.http.routers.smythos-app.rule=Host(`${APP_URL:-http://localhost}`)"
- "traefik.http.routers.smythos-app.entrypoints=web,websecure"
- "traefik.http.routers.smythos-app.service=smythos-app"
- "traefik.http.routers.smythos-app.middlewares=smythos@docker"
@@ -144,9 +144,9 @@ services:
# Service definition
- "traefik.http.services.smythos-app.loadbalancer.server.port=5050"
- # RUNTIME_DOMAIN routing to port 5053 (Runtime Server)
- # Only create routes if RUNTIME_DOMAIN is set
- - "traefik.http.routers.smythos-runtime.rule=Host(`${RUNTIME_DOMAIN:-runtime.localhost}`)"
+ # RUNTIME_URL routing to port 5053 (Runtime Server)
+ # Only create routes if RUNTIME_URL is set
+ - "traefik.http.routers.smythos-runtime.rule=Host(`${RUNTIME_URL:-http://runtime.localhost}`)"
- "traefik.http.routers.smythos-runtime.entrypoints=web,websecure"
- "traefik.http.routers.smythos-runtime.service=smythos-runtime"
- "traefik.http.routers.smythos-runtime.tls=true"
diff --git a/packages/app/src/backend/config.ts b/packages/app/src/backend/config.ts
index 8a0b16b1..3acde64e 100644
--- a/packages/app/src/backend/config.ts
+++ b/packages/app/src/backend/config.ts
@@ -25,9 +25,7 @@ const transformEnv = (env: string) => {
const MW_BASE_URL =
process.env.SMYTH_API_SERVER || `http://localhost:${process.env.MIDDLEWARE_API_PORT}`;
const UI_SERVER =
- process.env.UI_SERVER ||
- (process.env.APP_DOMAIN && `https://${process.env.APP_DOMAIN}`) ||
- `http://localhost:${process.env.APP_PORT}`;
+ process.env.UI_SERVER || process.env.APP_URL || `http://localhost:${process.env.APP_PORT}`;
const APP_PORT = +process.env.APP_PORT || +process.env.PORT;
diff --git a/packages/runtime/src/core/config.ts b/packages/runtime/src/core/config.ts
index 2a207a8a..3e4ad519 100644
--- a/packages/runtime/src/core/config.ts
+++ b/packages/runtime/src/core/config.ts
@@ -31,7 +31,7 @@ const config = {
ADMIN_PORT: process.env.RUNTIME_ADMIN_PORT || process.env.ADMIN_PORT || 5054,
- BASE_URL: process.env.RUNTIME_DOMAIN || `http://localhost:${process.env.RUNTIME_PORT}`,
+ BASE_URL: process.env.RUNTIME_URL || `http://localhost:${process.env.RUNTIME_PORT}`,
LOGTO_M2M_APP_ID: process.env.LOGTO_M2M_APP_ID,
@@ -43,7 +43,7 @@ const config = {
MAX_CONCURRENT_REQUESTS: process.env.MAX_CONCURRENT_REQUESTS || 50,
// UI_SERVER: process.env.UI_SERVER || 'http://localhost:4000',
- UI_SERVER: process.env.APP_DOMAIN || `http://localhost:${process.env.APP_PORT}` || 'http://localhost:5053',
+ UI_SERVER: process.env.APP_URL || `http://localhost:${process.env.APP_PORT}` || 'http://localhost:5053',
SESSION_SECRET: process.env.SESSION_SECRET,
DATA_PATH: process.env.DATA_PATH || getDefaultDataPath(),
diff --git a/packages/runtime/src/core/middlewares/cors.mw.ts b/packages/runtime/src/core/middlewares/cors.mw.ts
index 2dff73fa..f51e9021 100644
--- a/packages/runtime/src/core/middlewares/cors.mw.ts
+++ b/packages/runtime/src/core/middlewares/cors.mw.ts
@@ -3,8 +3,9 @@ import cors from 'cors';
import config from '@core/config';
// Minimal CORS - allow everything in development, configurable for production
+const allowedDomains = [config.env.PROD_AGENT_DOMAIN, config.env.UI_SERVER, config.env.DEFAULT_AGENT_DOMAIN, config.env.BASE_URL];
const corsOptions: cors.CorsOptions = {
- origin: process.env.NODE_ENV === 'production' ? process.env.CORS_ORIGINS?.split(',') || false : true,
+ origin: process.env.NODE_ENV === 'production' ? allowedDomains : true,
credentials: true,
methods: ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS'],
allowedHeaders: ['Content-Type', 'Authorization', 'X-Conversation-Id', 'X-Auth-Token', 'X-Parent-Cookie', 'X-Monitor-Id'],