Skip to content

Config Flow

This page explains how runtime configuration moves from files and CLI overrides into validated runtime state.

  1. 1Resolve config pathUse --config when provided; otherwise use the app directory location.
  2. 2Generate local examplesFirst run can create local example files without overwriting the tracked repository example.
  3. 3Parse config.tomlLoad TOML into the typed config schema.
  4. 4Validate invariantsRequired providers, routes, protocols, and timeout values are checked before startup completes.
  5. 5Build runtime stateValidated config becomes AppState used by request handling.
ConcernOwner
Config schemasrc/config.rs
App directory resolutionsrc/paths.rs
CLI flags and temporary overridessrc/cli/
Provider selection from configsrc/routing/ and pipeline routing step
Runtime request accessAppState in src/lib.rs
User-facing examplesconfig.example.toml, using/configuration, reference/configuration
InvariantWhy
Invalid config fails startupA partially-valid proxy would be harder to diagnose than a startup error.
Provider protocol controls outbound wire behaviorProvider names are arbitrary labels and cannot imply protocol semantics.
Route request_protocol guards are strictEndpoint-specific routing must not fall through silently.
tool_calls.timeout_secs must be positiveTool-call stalls need a bounded semantic timeout.
Local private config is not committedconfig.toml, captures, and logs can contain secrets or prompts.
  1. Add the typed field in src/config.rs.
  2. Add a concise example/comment in config.example.toml.
  3. Wire the setting into src/main.rs, src/lib.rs, or the owning module.
  4. Update user docs if behavior is user-facing.
  5. Update reference docs and tests for defaults/validation.