On this page
Sommatic Docs
Open portal

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.

View as Markdown
Open in

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.

JSON
{
  "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" }
  }
}
FieldDescription
nameEnvironment name. The connection in Sommatic AI points to it.
descriptionOptional.
branchThe branch the installation of this environment reads.
variablesNAME → value, for @@env.NAME@@ tokens: provider ids, credential ids, hosts, flags.
resourcesLogical key → physical id of the resource in this installation. It links each file to the record it updates and feeds @@ref.<key>@@ tokens.
secretsNAME → 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

TokenResolved 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:

JSON
{
  "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 by node_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>.json has 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’s unresolved array and apply refuses to write that resource.

Next steps

Install agent tools

Give your coding agent the official Sommatic AI docs: skills, the docs MCP server and Markdown pages, so it never has to scrape the site.

Skills only. They do not update by themselves; run it again to refresh.

npx skills add https://docs.sommatic.ai
How agents read these docs