Heuristic:AFK surf Open agent Leave Provider Config Keys Blank
| Knowledge Sources | |
|---|---|
| Domains | Configuration, Self_Hosting |
| Last Updated | 2026-10-25 00:00 GMT |
Overview
Leave unused provider config keys as empty strings in config.json rather than deleting them, so the JSON Schema stays satisfied and upgrades don't break on missing fields.
Description
The Open-Agent self-hosting config (`config.example.json`) is validated against `schema.json`. Every provider entry (`providers.openai.apiKey`, `providers.gemini.apiKey`, `providers.anthropic.apiKey`, OAuth `clientId`/`clientSecret`, mailer SMTP fields, storage credentials, ...) is present in the template as an empty string. The schema marks these as required-with-empty-allowed, so removing a key you don't use can fail schema validation; leaving it blank keeps the file valid and forward-compatible.
Usage
Apply this heuristic when editing config.json for self-hosting. Fill in the keys for the providers you use; leave the rest as `""` (or `false` for booleans like `mailer.enabled`).
The Insight (Rule of Thumb)
- Action: Keep every key from `config.example.json`; set unused secrets to `""` and unused toggles to `false`.
- Value: Empty string for string fields, `false` for booleans, `{}` for credential objects.
- Trade-off: Slightly more verbose config — but you gain schema stability across upgrades.
- Compatibility: The schema is the source of truth; `config.example.json` is the canonical template.
Reasoning
The JSON Schema is part of the app's startup contract (`$schema: ./schema.json`). A missing key that the schema requires (even if the app would tolerate an empty value) fails validation at boot, blocking startup. Empty strings satisfy `type: string` without requiring a real secret, so the app can skip unused providers cleanly. Keeping keys also makes diffs against the template trivial and survives schema additions on upgrade.
Code Evidence
Empty-string defaults across all providers from `.docker/config.example.json:1-81`:
{
"$schema": "./schema.json",
"oauth": {
"providers.github": { "clientId": "", "clientSecret": "" },
"providers.google": { "clientId": "", "clientSecret": "" }
},
"mailer": { "enabled": false, "SMTP": { "host": "", "password": "", ... } },
"copilot": {
"providers.openai": { "apiKey": "" },
"providers.anthropic": { "apiKey": "" },
"providers.gemini": { "apiKey": "" },
...
}
}
Schema reference declared at the top of the config from `.docker/config.example.json:2`:
"$schema": "./schema.json"