pub struct Config {Show 17 fields
pub workspace: PathBuf,
pub api_base: String,
pub api_key: Option<String>,
pub model: String,
pub provider_type: String,
pub preset: Option<String>,
pub max_steps: usize,
pub temperature: f64,
pub system_prompt: String,
pub retry_max: usize,
pub retry_initial_backoff_secs: u64,
pub retry_max_backoff_secs: u64,
pub shell_timeout_secs: u64,
pub headless: bool,
pub memory_summary_limit: usize,
pub thinking_budget: Option<u32>,
pub session_name: Option<String>,
}Fields§
§workspace: PathBuf§api_base: String§api_key: Option<String>§model: String§provider_type: String§preset: Option<String>Preset id resolved from provider.preset in the config file.
None when the user did not opt in (or the file was absent).
max_steps: usize§temperature: f64§system_prompt: String§retry_max: usize§retry_initial_backoff_secs: u64§retry_max_backoff_secs: u64§shell_timeout_secs: u64§headless: boolRun in headless mode: interactive tools go through external hooks instead of waiting for terminal input. If no hook approves the call, the tool is auto-denied.
memory_summary_limit: usize§thinking_budget: Option<u32>Extended thinking budget for models that support it (e.g. Anthropic claude-3-7).
None = model default; Some(0) = disable thinking; Some(n) = budget_tokens.
session_name: Option<String>Optional display name for the session, shown in the /resume picker.
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Load from environment, with config file (~/.recursive/config.toml) as fallback.
Precedence (highest first), applied to api_base / api_key / model /
provider_type:
- env var (e.g.
RECURSIVE_API_BASE,OPENAI_API_KEY) - explicit field in the file’s
[provider]section - preset field —
provider.preset = "<id>"looks up the bundledproviders.tomland takes itsapi_base/default_model/provider_type. Forapi_key, step 3 instead consultsstd::env::var(preset.key_env)(e.g.DEEPSEEK_API_KEY). - hardcoded default
The api_key chain is asymmetric: the generic env vars in step 1
(RECURSIVE_API_KEY / OPENAI_API_KEY) rank above the file’s explicit
api_key, but a preset’s specific env var in step 3 ranks below it.
Inverting step 3 would silently override a user’s api_key = "sk-old"
whenever DEEPSEEK_API_KEY happened to be in their shell.
The API key is optional here so commands that don’t need the LLM
(e.g. tools, config) still run.
Sourcepub fn require_api_key(&self) -> Result<&str>
pub fn require_api_key(&self) -> Result<&str>
Return the API key or a descriptive error if none was configured.
Sourcepub fn validate_for_agent(&self) -> Result<(), String>
pub fn validate_for_agent(&self) -> Result<(), String>
Validate that the config has enough information to run the agent. Returns a user-friendly error message if not.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnsafeUnpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more