Environments and tokens
An environment file holds what changes between installations (the branch, variables, resource ids and where to read secrets). Resource files reference those values with tokens that Sommatic AI resolves when it syncs, not at runtime.
The same workflow file runs in development and in production, but the two installations do not share ids: each has its own LLM provider, its own credentials and its own copy of every resource. Git Sync keeps those differences out of the resource files. Each installation has an environment file, and the resource files point to its values with tokens.
The environment file
environments/<name>.json lives at the root of the repository (or under the connection’s root path). The connection
in Sommatic AI names the environment it uses.
{
"name": "dev",
"description": "Development installation",
"branch": "development",
"variables": {
"LLM_PROVIDER_ID": "wf-llm-provider-xxxxxxxxxxxxxxx",
"CRM_CREDENTIAL_ID": "pi-credential-xxxxxxxxxxxxxxx",
"CRM_BASE_URL": "https://crm.dev.example.com"
},
"resources": {
"support.triage": "wf-flow-definition-xxxxxxxxxxxxxxx",
"support.faq": "knowledge-resource-xxxxxxxxxxxxxxx"
},
"secrets": {
"LEGACY_API_TOKEN": { "from": "live" },
"PARTNER_KEY": { "from": "credential", "id": "pi-credential-xxxxxxxxxxxxxxx" }
}
}| Field | Description |
|---|---|
name | Environment name. The connection in Sommatic AI points to it. |
description | Optional. |
branch | The branch the installation of this environment reads. |
variables | NAME → value, for @@env.NAME@@ tokens: provider ids, credential ids, hosts, flags. |
resources | Logical key → physical id of the resource in this installation. It links each file to the record it updates and feeds @@ref.<key>@@ tokens. |
secrets | NAME → where Sommatic AI reads the secret on the server. Never the value itself. |
The JSON Schema is published at
https://docs.sommatic.ai/schemas/git-sync/environment.schema.json.
Tokens
| Token | Resolved with |
|---|---|
@@env.NAME@@ | variables.NAME of the environment. |
@@ref.<key>@@ | resources.<key>: the physical id of another resource, for example a sub-workflow called by workflow.chain. |
@@secret.NAME@@ | secrets.NAME, on the server only. |
A token can be the whole value or part of a string:
{
"config": {
"connection_id": "@@env.CRM_CREDENTIAL_ID@@",
"method": "POST",
"url": "@@env.CRM_BASE_URL@@/tickets"
}
}Secrets
Prefer credentials for anything secret: a node with a credential picker stores only the
credential id (connection_id), which is a normal @@env variable. Use @@secret tokens only for a value that has to
live inside a node’s configuration. Two sources are available:
{ "from": "live" }keeps the value that the live resource already has at the same place. Nodes are matched bynode_id, so the secret survives as long as the node keeps its id.{ "from": "credential", "id": "…" }reads the value of a Sommatic AI credential.
The secret value never goes into Git: the repository only holds the token and, in the environment file, where to read it.
Resolved on sync, not at runtime
Tokens are replaced when you preview and apply. Sommatic AI stores the resolved values in the workflow draft or the knowledge resource; the running workflow never sees a token. Two consequences:
- Changing a value in
environments/<env>.jsonhas no effect until the next apply of the resources that use it. - If a token cannot be resolved (an unknown variable, a key missing from
resources, a secret without a source), the preview lists it in the item’sunresolvedarray and apply refuses to write that resource.