diff --git a/content/Get-Started/app-configuration.mdx b/content/Get-Started/app-configuration.mdx index cbd16229..cf91840e 100644 --- a/content/Get-Started/app-configuration.mdx +++ b/content/Get-Started/app-configuration.mdx @@ -159,6 +159,30 @@ If you don't set provider API keys, LLM requests are routed through the Agentuit Environment variables prefixed with `AGENTUITY_PUBLIC_`, `VITE_`, or `PUBLIC_` are exposed to the frontend bundle and visible in the browser. Never put secrets or API keys in these variables. +### Platform-Injected Environment Variables + +When your project is deployed to Agentuity Cloud, the platform automatically injects the following environment variables into your runtime. You do not need to set these yourself. + +| Variable | Description | +|----------|-------------| +| `AGENTUITY_CLOUD_BASE_URL` | The base URL of your deployment (e.g., `https://dep-abc123.agentuity.cloud`). Used internally for authentication callbacks and as the canonical URL for the running deployment. | +| `AGENTUITY_CLOUD_DOMAINS` | Comma-separated list of all domains associated with the deployment, including the deployment URL, project URL, any custom domains (CNAMEs), and PR preview URLs. | +| `AGENTUITY_CLOUD_ORG_ID` | Your organization ID. | +| `AGENTUITY_CLOUD_PROJECT_ID` | Your project ID. | +| `AGENTUITY_CLOUD_DEPLOYMENT_ID` | The current deployment ID. | + +```typescript +// Access the deployed URL +const baseUrl = process.env.AGENTUITY_CLOUD_BASE_URL; + +// Access all associated domains +const domains = process.env.AGENTUITY_CLOUD_DOMAINS?.split(','); +``` + + +`AGENTUITY_CLOUD_BASE_URL` and `AGENTUITY_CLOUD_DOMAINS` are automatically used by the runtime for CORS origin validation and by `@agentuity/auth` for trusted origins. You typically don't need to reference them directly unless you have custom domain logic. + + ## Infrastructure as Code Unlike traditional platforms, Agentuity defines infrastructure in your route files: diff --git a/content/Reference/CLI/deployment.mdx b/content/Reference/CLI/deployment.mdx index b71f2f61..52fd5754 100644 --- a/content/Reference/CLI/deployment.mdx +++ b/content/Reference/CLI/deployment.mdx @@ -78,6 +78,30 @@ agentuity deploy Both URLs are automatically provisioned with HTTPS. The project URL always routes to the active deployment. +### Deployment Environment Variables + +When deployed, the platform automatically injects environment variables so your agents can discover their own URLs at runtime: + +| Variable | Description | +|----------|-------------| +| `AGENTUITY_CLOUD_BASE_URL` | The base URL of the current deployment (e.g., `https://dep-abc123.agentuity.cloud`). | +| `AGENTUITY_CLOUD_DOMAINS` | Comma-separated list of all domains for the deployment — deployment URL, project URL, custom domains (CNAMEs), and PR preview URLs. | +| `AGENTUITY_CLOUD_DEPLOYMENT_ID` | The current deployment ID. | +| `AGENTUITY_CLOUD_PROJECT_ID` | The project ID. | +| `AGENTUITY_CLOUD_ORG_ID` | The organization ID. | + +```typescript +// Get the canonical URL for this deployment +const myUrl = process.env.AGENTUITY_CLOUD_BASE_URL; + +// Get all domains (including custom domains / CNAMEs) +const domains = process.env.AGENTUITY_CLOUD_DOMAINS?.split(','); +``` + + +These variables are automatically used by the runtime for CORS origin validation and by `@agentuity/auth` for trusted origins. You only need to reference them directly if you have custom domain logic. + + ## Viewing Deployments List recent deployments: diff --git a/content/Reference/sdk-reference.mdx b/content/Reference/sdk-reference.mdx index c8abb730..260227d8 100644 --- a/content/Reference/sdk-reference.mdx +++ b/content/Reference/sdk-reference.mdx @@ -126,6 +126,20 @@ Agentuity applications access configuration and secrets through standard Node.js - `AGENTUITY_SDK_KEY` - SDK-level API key (used in development to access Agentuity Cloud) - `AGENTUITY_PROJECT_KEY` - Project-level API key (used when deployed) +**Platform-Injected Environment Variables (Cloud Deployments):** + +These are automatically set by the Agentuity platform when your project is deployed. You do not need to configure them. + +| Variable | Description | +|----------|-------------| +| `AGENTUITY_CLOUD_BASE_URL` | The base URL of your deployment (e.g., `https://dep-abc123.agentuity.cloud`). Used for authentication callbacks and as the canonical deployment URL. | +| `AGENTUITY_CLOUD_DOMAINS` | Comma-separated list of all domains for the deployment — includes the deployment URL, project URL, custom domains (CNAMEs), and PR preview URLs. | +| `AGENTUITY_CLOUD_ORG_ID` | Your organization ID. | +| `AGENTUITY_CLOUD_PROJECT_ID` | Your project ID. | +| `AGENTUITY_CLOUD_DEPLOYMENT_ID` | The current deployment ID. | + +`AGENTUITY_CLOUD_BASE_URL` and `AGENTUITY_CLOUD_DOMAINS` are used automatically by the runtime for CORS origin validation and by `@agentuity/auth` for trusted origins. + **Example** ```typescript @@ -143,9 +157,13 @@ const { server, logger } = await createApp(); const apiEndpoint = process.env.API_ENDPOINT || 'https://api.example.com'; const openaiKey = process.env.OPENAI_API_KEY; // Optional: you can use the AI Gateway to access OpenAI, Anthropic, etc without needing to set various API keys. + +// Access platform-injected variables (available in cloud deployments) +const deployedUrl = process.env.AGENTUITY_CLOUD_BASE_URL; +const allDomains = process.env.AGENTUITY_CLOUD_DOMAINS?.split(','); ``` -**Note**: Environment variables are typically loaded from a `.env` file in development and configured in your deployment environment. +**Note**: Environment variables are typically loaded from a `.env` file in development and configured in your deployment environment. Platform-injected variables like `AGENTUITY_CLOUD_BASE_URL` and `AGENTUITY_CLOUD_DOMAINS` are only available when deployed to Agentuity Cloud. ---