Configuration files, CLI flags, and environment variables¶
URSA configs can be layered. Use YAML files for reusable settings, environment variables for secrets or automation, and CLI flags for temporary overrides.
Configuration precedence¶
URSA loads configuration in this order, with later sources overriding earlier ones:
- Built-in defaults
- The native platform system config
- User configs: native platform location,
~/.config/ursa/config.yaml, then$XDG_CONFIG_HOME/ursa/config.yaml - Environment variables
- The file passed to
--config - CLI flags
Higher-precedence sources only override settings they specify. Set a nullable
setting to null to clear it.
XDG_CONFIG_HOME is supported on every platform and only affects the user
configuration layer.
Default configuration paths¶
| Platform | System config | Native user config |
|---|---|---|
| Linux and other Unix | /etc/ursa/config.yaml |
~/.config/ursa/config.yaml |
| macOS | /Library/Application Support/ursa/config.yaml |
~/Library/Application Support/ursa/config.yaml |
| Windows | %PROGRAMDATA%\ursa\config.yaml |
%APPDATA%\ursa\config.yaml |
On every platform, URSA then checks ~/.config/ursa/config.yaml and, when
XDG_CONFIG_HOME is set, $XDG_CONFIG_HOME/ursa/config.yaml. These user files
are loaded in that order, with duplicates skipped. A missing file is ignored.
User YAML files: preferred¶
For defaults that should follow you across projects, edit the user config path listed above. A small user config is usually better than a complete copy of the resolved defaults. For example:
OpenAI chat needs no YAML; set OPENAI_API_KEY and run ursa. Use an explicit
file only for a project-specific or one-off override:
YAML files are best when you want to reuse the same model, workspace, group, MCP server, or agent settings across multiple runs.
CLI flags: useful overrides¶
Common flags include:
--workspace
--group
--thread_id
--use_web
--name
--llm_model.model
--llm_model.base_url
--llm_model.api_key.env
--llm_model.ssl_verify
--llm_model.max_completion_tokens
--emb_model
--mcp_servers
--rag-tools
Use ursa --help for the authoritative list.
Environment variables: secrets and automation¶
URSA exposes environment-variable equivalents for many CLI settings, but for most users environment variables are best for API keys and automated deployment.
Example:
Then in YAML:
You can also set URSA configuration options directly:
Use ursa --help to view supported URSA_... variables.
Environment interpolation in config files¶
URSA config loading supports environment interpolation in YAML values. For MCP server environment blocks, this is useful for passing secrets to subprocesses:
mcp_servers:
example:
transport: stdio
command: example-server
env:
API_KEY: ${EXAMPLE_API_KEY}
OPTIONAL_SETTING: ${OPTIONAL_SETTING:default-value}
Inspect the active configuration¶
--print-config prints the full active configuration, including defaults and
null values:
To inspect values before provider settings and other derived values are applied:
You can also inspect a particular file layer:
The complete form is --print-config=LEVEL[+],STAGE. Levels are system,
user, file, and final; stages are merged and resolved. Add + to include
lower-precedence sources.