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.

rename AGENT_DOMAIN with DEFAULT_AGENT_DOMAIN

Forhad Hosaind1e348337838
diff --git a/packages/runtime/.env.example b/packages/runtime/.env.example
index ad4244ca..717d9661 100644
--- a/packages/runtime/.env.example
+++ b/packages/runtime/.env.example
@@ -16,7 +16,7 @@ UI_SERVER="http://localhost:4000"
SESSION_SECRET="session-secret"
# DEFAULT_AGENT_DOMAIN serves as the staging/development wildcard domain (e.g., agentid.staging.smythos.dev) where non-deployed agents are automatically accessible for testing and development purposes.
-DEFAULT_AGENT_DOMAIN="localhost"
+DEFAULT_AGENT_DOMAIN="localagent.stage.smyth.ai"
# PROD_AGENT_DOMAIN is the production wildcard domain (e.g., agentid.smythos.ai) where deployed agents are served to end users, with the system automatically routing agents to this domain once they are marked as deployed.
PROD_AGENT_DOMAIN="agentid.smythos.com"
diff --git a/packages/runtime/src/core/config.ts b/packages/runtime/src/core/config.ts
index 039df130..fa0a304e 100644
--- a/packages/runtime/src/core/config.ts
+++ b/packages/runtime/src/core/config.ts
@@ -17,7 +17,7 @@ const config = {
LOGTO_M2M_APP_ID: process.env.LOGTO_M2M_APP_ID,
- AGENT_DOMAIN: process.env?.AGENT_DOMAIN,
+ DEFAULT_AGENT_DOMAIN: process.env?.DEFAULT_AGENT_DOMAIN,
PROD_AGENT_DOMAIN: process.env?.PROD_AGENT_DOMAIN,
AGENT_DOMAIN_PORT: process.env?.AGENT_DOMAIN_PORT,
diff --git a/packages/runtime/src/core/helpers/agent.helper.ts b/packages/runtime/src/core/helpers/agent.helper.ts
index 8bbde22a..f5b80380 100644
--- a/packages/runtime/src/core/helpers/agent.helper.ts
+++ b/packages/runtime/src/core/helpers/agent.helper.ts
@@ -57,7 +57,7 @@ export async function getAgentDomainById(agentId: string) {
if (deployed) {
return `${agentId}.${config.env.PROD_AGENT_DOMAIN}`;
} else {
- return `${agentId}.${config.env.AGENT_DOMAIN}`;
+ return `${agentId}.${config.env.DEFAULT_AGENT_DOMAIN}`;
}
}
return domain;
@@ -126,12 +126,14 @@ export async function getAgentEmbodiments(agentID) {
export async function getAgentIdByDomain(domain = "") {
let agentId;
//first check if this is the internal wildcard agents domain
- const isStageWildcardDomain = domain.includes(config.env.AGENT_DOMAIN);
+ const isStageWildcardDomain = domain.includes(
+ config.env.DEFAULT_AGENT_DOMAIN
+ );
const isProdWildcardDomain = domain.includes(config.env.PROD_AGENT_DOMAIN);
if (isStageWildcardDomain || isProdWildcardDomain) {
agentId = domain.split(".")[0];
if (
- `${agentId}.${config.env.AGENT_DOMAIN}` !== domain &&
+ `${agentId}.${config.env.DEFAULT_AGENT_DOMAIN}` !== domain &&
`${agentId}.${config.env.PROD_AGENT_DOMAIN}` !== domain
) {
throw new Error(`Invalid agent domain: ${domain}`);
diff --git a/packages/runtime/src/index.ts b/packages/runtime/src/index.ts
index a84f7a6e..c565a529 100644
--- a/packages/runtime/src/index.ts
+++ b/packages/runtime/src/index.ts
@@ -80,7 +80,7 @@ const sre = SmythRuntime.Instance.init({
AgentData: {
Connector: "SmythOSSAgentData",
Settings: {
- agentStageDomain: config.env.AGENT_DOMAIN || "",
+ agentStageDomain: config.env.DEFAULT_AGENT_DOMAIN || "",
agentProdDomain: config.env.PROD_AGENT_DOMAIN || "",
oAuthAppID: config.env.LOGTO_M2M_APP_ID,
oAuthAppSecret: config.env.LOGTO_M2M_APP_SECRET,
@@ -150,7 +150,9 @@ app.use(
return req.sessionID;
}
const domain = req.hostname;
- const isTestDomain = domain.includes(`.${config.env.AGENT_DOMAIN}`);
+ const isTestDomain = domain.includes(
+ `.${config.env.DEFAULT_AGENT_DOMAIN}`
+ );
const prefix = isTestDomain ? "test-" : "";
const formattedDate = getCurrentFormattedDate();
const randomString = crypto.randomBytes(8).toString("hex");
@@ -166,7 +168,7 @@ app.use(express.urlencoded({ extended: false, limit: "100kb" }));
// Health endpoint
app.get("/health", (req: any, res) => {
- let agent_domain = config.env.AGENT_DOMAIN;
+ let agent_domain = config.env.DEFAULT_AGENT_DOMAIN;
if (config.env.AGENT_DOMAIN_PORT)
agent_domain += `:${config.env.AGENT_DOMAIN_PORT}`;
diff --git a/packages/runtime/src/modules/agent-runner/middlewares/agentLoader.mw.ts b/packages/runtime/src/modules/agent-runner/middlewares/agentLoader.mw.ts
index 330e0e8e..4331c5c7 100644
--- a/packages/runtime/src/modules/agent-runner/middlewares/agentLoader.mw.ts
+++ b/packages/runtime/src/modules/agent-runner/middlewares/agentLoader.mw.ts
@@ -1,11 +1,11 @@
import { ConnectorService, Logger } from "@smythos/sre";
+import config from "@core/config";
import {
addDefaultComponentsAndConnections,
extractAgentVerionsAndPath,
getAgentDomainById,
} from "@core/helpers/agent.helper";
-import config from "@core/config";
import { DEFAULT_FILE_PARSING_ENDPOINT } from "@agent-runner/constants";
@@ -46,7 +46,7 @@ export default async function agentLoader(req, res, next) {
console.error("Error calling getAgentIdByDomain:", error);
}
agentDomain = domain;
- if (agentId && domain.includes(config.env.AGENT_DOMAIN)) {
+ if (agentId && domain.includes(config.env.DEFAULT_AGENT_DOMAIN)) {
isTestDomain = true;
}
}
diff --git a/packages/runtime/src/modules/debugger/middlewares/agentLoader.mw.ts b/packages/runtime/src/modules/debugger/middlewares/agentLoader.mw.ts
index ff1c8a87..9763dc69 100644
--- a/packages/runtime/src/modules/debugger/middlewares/agentLoader.mw.ts
+++ b/packages/runtime/src/modules/debugger/middlewares/agentLoader.mw.ts
@@ -51,7 +51,7 @@ export default async function agentLoader(req, res, next) {
}
}
agentDomain = domain;
- if (agentId && domain.includes(config.env.AGENT_DOMAIN)) {
+ if (agentId && domain.includes(config.env.DEFAULT_AGENT_DOMAIN)) {
isTestDomain = true;
}
if (agentId) {
diff --git a/packages/runtime/src/modules/embodiment/helpers/openapi-adapter.helper.ts b/packages/runtime/src/modules/embodiment/helpers/openapi-adapter.helper.ts
index 751141b6..b6aa295e 100644
--- a/packages/runtime/src/modules/embodiment/helpers/openapi-adapter.helper.ts
+++ b/packages/runtime/src/modules/embodiment/helpers/openapi-adapter.helper.ts
@@ -79,13 +79,13 @@ function constructServerUrl(domain: string): string {
const server_url_scheme =
config.env.NODE_ENV === "development" &&
config.env.AGENT_DOMAIN_PORT &&
- domain.includes(config.env.AGENT_DOMAIN)
+ domain.includes(config.env.DEFAULT_AGENT_DOMAIN)
? "http"
: "https";
const server_url_port =
config.env.NODE_ENV === "development" &&
config.env.AGENT_DOMAIN_PORT &&
- domain.includes(config.env.AGENT_DOMAIN)
+ domain.includes(config.env.DEFAULT_AGENT_DOMAIN)
? `:${config.env.AGENT_DOMAIN_PORT}`
: "";
return `${server_url_scheme}://${domain}${server_url_port}`;
diff --git a/packages/runtime/src/modules/embodiment/middlewares/agentLoader.mw.ts b/packages/runtime/src/modules/embodiment/middlewares/agentLoader.mw.ts
index f34f69e6..14f783b7 100644
--- a/packages/runtime/src/modules/embodiment/middlewares/agentLoader.mw.ts
+++ b/packages/runtime/src/modules/embodiment/middlewares/agentLoader.mw.ts
@@ -8,11 +8,11 @@ import {
import config from "@core/config";
import {
+ addDefaultComponentsAndConnections,
extractAgentVerionsAndPath,
getAgentDomainById,
getAgentIdAndVersion,
} from "@core/helpers/agent.helper";
-import { addDefaultComponentsAndConnections } from "@core/helpers/agent.helper";
const console = Logger("[Embodiment] Middleware: Agent Loader");
@@ -61,7 +61,7 @@ export default async function agentLoader(req, res, next) {
console.error("Error calling getAgentIdByDomain:", error);
}
agentDomain = domain;
- if (agentId && domain.includes(config.env.AGENT_DOMAIN)) {
+ if (agentId && domain.includes(config.env.DEFAULT_AGENT_DOMAIN)) {
isTestDomain = true;
}
}
diff --git a/packages/runtime/src/modules/embodiment/modules/agentChat/routes/router.ts b/packages/runtime/src/modules/embodiment/modules/agentChat/routes/router.ts
index be528ed8..eb566371 100644
--- a/packages/runtime/src/modules/embodiment/modules/agentChat/routes/router.ts
+++ b/packages/runtime/src/modules/embodiment/modules/agentChat/routes/router.ts
@@ -142,7 +142,9 @@ router.post("/stream", async (req, res) => {
router.post("/new", async (req, res) => {
const { conversation = {} } = req.body;
- const isTestDomain = req.hostname.includes(`.${config.env.AGENT_DOMAIN}`);
+ const isTestDomain = req.hostname.includes(
+ `.${config.env.DEFAULT_AGENT_DOMAIN}`
+ );
let agentId = req.header("X-AGENT-ID");
const teamDetails = requestContext.get(`team_info:${agentId}`);
diff --git a/packages/runtime/src/modules/embodiment/modules/chatbot/routes/router.ts b/packages/runtime/src/modules/embodiment/modules/chatbot/routes/router.ts
index 53fc1a42..859a6308 100644
--- a/packages/runtime/src/modules/embodiment/modules/chatbot/routes/router.ts
+++ b/packages/runtime/src/modules/embodiment/modules/chatbot/routes/router.ts
@@ -90,7 +90,7 @@ initDebug('${config.env.UI_SERVER}', '${agent.id}');
logo: '${logo}',
introMessage: '${introMessage}',
allowAttachments: ${allowAttachments},
- //domain:'${agent.id}.${config.env.AGENT_DOMAIN}',
+ //domain:'${agent.id}.${config.env.DEFAULT_AGENT_DOMAIN}',
colors: ${JSON.stringify(colors, null, 2)},
isChatOnly: true,
containerId: 'smyth-chatbot-page',
@@ -324,7 +324,9 @@ router.get("/params", async (req, res) => {
//* Note: chatbot conversations are not created in db table, it is just a uid created on the fly
//* On the other hand, Agent Chat conversations are created in db table and can be retrieved from db
- const isTestDomain = req.hostname.includes(`.${config.env.AGENT_DOMAIN}`);
+ const isTestDomain = req.hostname.includes(
+ `.${config.env.DEFAULT_AGENT_DOMAIN}`
+ );
const conversationId = buildConversationId(undefined, isTestDomain);
chatbotProperties.headers = {