产品介绍

Configuration selection and merging

Use this page to establish where defaults come from or why a value did not take effect. For the first model connection and startup, see configuration basics.

The following walkthrough shows each stage and the origin of the final values.

Select the participating files

Item Without an explicit option With an explicit option
Home ~/.dataagent Set DATAAGENT_HOME in the launch process
Product YAML <home>/config.yaml --config /srv/demo/config.yaml selects this one product file
Environment file <home>/.env --env-file /srv/demo/model.env selects this one environment file

For example, select both files explicitly:

uv run --no-sync dataagent serve \
  --config /srv/demo/config.yaml \
  --env-file /srv/demo/model.env

Home is not affected by --config and --env-file. Session state and user extensions continue to use that Home.

Startup selects one product YAML. With --config, the model, plugin, Hook, and listener settings in Home config.yaml do not participate. Omitted product fields use program defaults. For example, if the Home server section sets host: 0.0.0.0 and run_timeout_seconds: 90 while the selected file omits both, the effective values are 127.0.0.1 and 900 seconds (15 minutes). The selected file supplies its own required model connection.

With only --config, the environment file remains Home .env. Working-directory config.yaml, configurations in input directories, and an .env beside --config are not automatically added.

What each YAML file controls

File Content Merge participation
Selected product config.yaml, version 4 dataagent, models, plugins, server, semantic, a2a Selects plugins and supplies the final overrides above plugin defaults
Plugin .plugin.yaml, version 3 ID, dependencies, tools, Skills, subagents, Hooks, optional params and defaults_file params contributes defaults under this plugin's plugins.config.<id>
YAML selected by a plugin's defaults_file Only plugins.config, for example defaults for itself and its dependencies Applied immediately after that plugin's params, in plugin load order
Subagent YAML, version 1 Standard or compiled subagent declarations Read during extension assembly, see subagents
.mcp.yaml MCP connection declarations Loaded from Home and enabled plugin sources, see the MCP reference

A defaults_file containing models, server, dataagent, plugins.enabled, or plugins.paths fails validation. The selected product YAML controls model connections, listener settings, and plugin selection.

Resolve plugins, then apply layers

  1. Read the selected product YAML to obtain plugins.enabled and plugins.paths.
  2. Locate enabled IDs among built-in, Home, and explicit candidates. Each plugins.paths entry names one plugin directory. Candidate sources have no override order. Multiple distinct real directories for one enabled ID cause an error.
  3. Visit plugins in plugins.enabled order. For each plugin, recursively visit requires in declaration order before adding the plugin itself. Load each ID once.
  4. In the resulting plugin order, apply that plugin's params, immediately followed by that plugin's defaults_file. Skip undeclared sources.
  5. Overlay the selected product YAML last, then fill still-missing product fields from program defaults. Plugin factories can subsequently fill omitted business parameters with their parameter models.

For example, the product enables d, which requires [b, c], and both b and c require a. The resulting order is a → b → c → d. Layers are applied in the following order, with later values taking precedence:

a.params → a.defaults_file
→ b.params → b.defaults_file
→ c.params → c.defaults_file
→ d.params → d.defaults_file
→ selected product YAML

plugins.config.<id> supplies parameters. Loading the plugin requires an explicit enabled ID or a dependency declared by another plugin.

A complete example with five sources

The following base and app plugins demonstrate configuration preparation. Their business fields are illustrative. Executing Hooks and business tasks additionally requires their implementations and graph declarations.

<home>/plugins/
  base/
    .plugin.yaml
    defaults.yaml
  app/
    .plugin.yaml
    defaults.yaml
/srv/demo/
  config.yaml
  model.env

Source one, base/.plugin.yaml. params directly contains this plugin's parameters, without a plugins.config.base wrapper.

schema_version: 3
id: base
defaults_file: defaults.yaml
params:
  limit: 100
  format:
    header: true
    delimiter: ","
  tags: [raw]
  nullable: inherited
  run_hooks:
    before_run:
      - entrypoint: hooks.py:record
        params: {source: params}

Source two, base/defaults.yaml. This file uses the full plugins.config wrapper.

plugins:
  config:
    base:
      limit: 80
      format:
        delimiter: "\t"
      tags: [default]
      run_hooks:
        before_run:
          - entrypoint: hooks.py:record
            params: {source: defaults}

Source three, app/.plugin.yaml. app depends on base. Its own params contributes only to app.

schema_version: 3
id: app
requires: [base]
defaults_file: defaults.yaml
params:
  mode: batch

Source four, app/defaults.yaml. The dependent plugin adjusts base defaults and adds a workflow Hook.

plugins:
  config:
    base:
      limit: 60
      format:
        encoding: utf-8
      run_hooks:
        before_run:
          - entrypoint: hooks.py:record
            params: {source: app-defaults}

Source five, /srv/demo/config.yaml. Enable app explicitly. Its dependency loads base. Put the three LLM_* values from configuration basics in model.env.

schema_version: 4
models:
  primary:
    provider: openai
    name: $env{LLM_MODEL}
    base_url: $env{LLM_BASE_URL}
    api_key: $env{LLM_API_KEY}
plugins:
  enabled: [app]
  config:
    base:
      limit: 20
      format: {}
      tags: []
      nullable: null
      run_hooks:
        before_run: []
        after_run:
          - entrypoint: audit.py:done

Applying these five sources produces the following plugins.config.base:

limit: 20
format:
  header: true
  delimiter: "\t"
  encoding: utf-8
tags: []
nullable: null
run_hooks:
  before_run:
    - entrypoint: hooks.py:record
      params: {source: params}
    - entrypoint: hooks.py:record
      params: {source: defaults}
    - entrypoint: hooks.py:record
      params: {source: app-defaults}
  after_run:
    - entrypoint: audit.py:done
Final value How it was obtained
limit: 20 Changes through 100 → 80 → 60 → 20, ending with the product override
format.header: true Supplied by source one and inherited by later sources
format.delimiter: "\t" Source two replaces the comma and later sources inherit it
format.encoding: utf-8 Added by source four
All three format fields remain Product {} contributes zero fields and keeps the existing object contents
tags: [] An ordinary list is replaced, so the product clears it
nullable: null Explicit null replaces inherited, which these illustrative parameters allow
Three before_run registrations Sources one, two, and four append in order. The product's empty list adds zero entries
One after_run registration Added by source five

The effective enabled order is [base, app], and plugins.config.app is {mode: batch}. The omitted server.host, server.port, and server.run_timeout_seconds become 127.0.0.1, 8790, and 900.

Objects, lists, empty values, and Hooks

Higher-priority value Merge meaning
Omitted field Inherit an earlier value. Use a field default only if still missing
Object with some keys Recursively override those keys and retain other keys
{} Add zero keys to an existing object, keeping inherited contents
Ordinary list such as tags: [new] Replace the whole list, without merging elements by ID
Ordinary [] Clear the old list
Valid scalar such as false, 0, or a string Replace the old value, subject to field validation
null Explicitly replace with null where the field allows it
Designated Hook list Append in source order, retaining duplicate registrations

Appending applies only to dataagent.hooks, plugins.config.<id>.run_hooks.before_run, and after_run. Other business lists named hooks use ordinary replacement. Grouped dataagent.hooks declarations are normalized into an event list when loaded.

A manifest's hooks is an independent extension declaration loaded with the plugin. Product dataagent.hooks: [] declares zero product Hooks. To remove an inherited workflow Hook in this example, edit the source that supplies it or disable the supplying plugin. See the Hook guide for functions and execution boundaries.

Paths retain their declaring source

Two Hooks with the same entrypoint text can refer to different files. In this example, the three before_run base directories are base/, base/, and app/. The after_run base directory is /srv/demo/.

Path Base directory or requirement
Relative CLI --config and --env-file Launch working directory
Product plugins.paths, input_workspaces[].path, semantic TLS files Selected product YAML directory
Manifest resources and defaults_file Plugin root, with declared resources confined to that root
Workflow Hooks in manifest params or defaults_file Declaring plugin root, including Hooks contributed to a dependency
Agent and workflow Hooks in product YAML Selected product YAML directory
Ordinary business parameter path strings Interpreted by that plugin
dataagent.output_root Absolute path or a path starting with ~/

When environment values are resolved

Load the selected environment file, then overlay nonempty process environment values. For example, file LLM_MODEL=file-model and process LLM_MODEL=process-model resolve name: $env{LLM_MODEL} to process-model. A literal name: fixed-model keeps the literal value.

Non-models references are expanded and validated while loading each source. A missing variable, invalid type, or invalid defaults-file structure in an earlier source can fail before later overrides are applied. Fix the participating invalid source even if a higher layer supplies a valid value.

Model fields are merged before resolving the selected default model. Other models resolve on first get_model("alias") using the startup environment snapshot. Restart the Server after editing environment files. See the environment reference for empty values, source launcher preloading, and process-only variables.

Inspect prepare_runtime().report.configs for sources and their applied flags, settings.plugins.enabled for the resolved plugin order, and settings.plugins.config for final parameters. This example prints only base parameters so full model credentials are not included:

from dataagent import LaunchOptions, prepare_runtime

runtime = prepare_runtime(
    LaunchOptions(
        config="/srv/demo/config.yaml",
        env_file="/srv/demo/model.env",
    )
)
for source in runtime.report.configs:
    print(source.scope, source.path, source.applied)
print(runtime.settings.plugins.enabled)
print(runtime.settings.plugins.config["base"])

Implementation and tests are in startup, field merging, dependency resolution, configuration tests, and file selection tests. See the configuration reference for the rule summary.

Restart after changing the model, service address, port, Home, input directories, or dataagent.entry. Plugin, Skill, Hook, and MCP declarations can refresh before the next turn, as described in the extension lifecycle. refresh_extensions does not change the entry.