Skip to main content

EngineConfig

Struct EngineConfig 

Source
pub struct EngineConfig {
Show 23 fields pub provider: Option<String>, pub model: String, pub max_tokens: u32, pub permission_prompt_timeout_secs: u64, pub tool_cancel_grace: Duration, pub max_parallelism: usize, pub max_api_calls_per_turn: u32, pub strong_model: Option<String>, pub permission_mode: PermissionMode, pub sandbox: Arc<SandboxSettings>, pub disable_skill_shell_execution: bool, pub project_trust: ProjectTrust, pub prompt_files: PromptFiles, pub layout: Layout, pub subprocess_env: SubprocessEnv, pub file_limits: FileLimits, pub system_prompt: SystemPromptSettings, pub max_agent_depth: u32, pub verbose_tool_results: bool, pub path_style: PathStyle, pub deferred_tools: Arc<HashSet<String>>, pub tool_results: ToolResultLimits, pub model_autonomy: ModelAutonomy,
}
Expand description

引擎只读配置。从 settings.json + CLI flags 合并出来后,整个会话不再变。

Fields§

§provider: Option<String>

Provider id (e.g. “anthropic”, “deepseek”, “xai”).

§model: String§max_tokens: u32§permission_prompt_timeout_secs: u64

How long a tool call waits for a permission answer before denying. 0 = wait indefinitely. See the permissions.prompt_timeout_secs setting.

§tool_cancel_grace: Duration

How long a tool call still running when its turn is cancelled is given to stop on its own before it is dropped and answered as cancelled.

§max_parallelism: usize

Maximum number of concurrency-safe tools to run in parallel within a single batch. 0 = unlimited. Default 10.

§max_api_calls_per_turn: u32

+** — per-turn API call budget. Default 200. When exceeded, engine returns gracefully with StopReason::MaxTurns instead of an error — partial work is preserved and surfaced to the caller. Lower this for sub- agents you want to cap (e.g. compactors at 1, memory-extractors at 5).

§strong_model: Option<String>

Auto-routing: optional “strong” tier model. When set, the engine starts each turn at model (cheap/fast tier, e.g. ds-v4-flash) and escalates to strong_model mid-turn on any of these signals:

  • tool_calls_so_far >= 3 (multi-step exploration)
  • previous tool_result was an error (need smarter retry)
  • turn message count >= 8 (deep conversation)

Once escalated, stays at strong for rest of the turn. None = no routing (use model for everything; current default). User-facing API: surface as --strong-model CLI flag, or in ~/.agix/scenes/<scope>/settings.json.

§permission_mode: PermissionMode§sandbox: Arc<SandboxSettings>

The session’s sandbox settings; every policy a command runs under is derived from these.

§disable_skill_shell_execution: bool

Settings.skills.allow_shell, the other way round — read by the skill expansion’s !`cmd` step via ToolContext.config.

§project_trust: ProjectTrust

Whether the project tier is in effect (LoadedSettings::trust); an untrusted project’s skill !`cmd` is not run.

§prompt_files: PromptFiles

How the engine reads the files it puts in front of the model.

§layout: Layout

What the instance names its directories, for the tools that make one or name one to the model.

§subprocess_env: SubprocessEnv

Mirrors Settings.sandbox.env.

§file_limits: FileLimits

File read/write byte/line limits. Sub-config keeps related field values together so cross-tool tuning (Read/Write/Edit) is one import path.

§system_prompt: SystemPromptSettings

system prompt overrides + extras (AGENTS.md walk, output styles, append/override). All affect what gets baked into block [1-5] of the system prompt.

§max_agent_depth: u32

最大 agent 嵌套深度。主 agent 深度 0,每经 AgentTool spawn 加 1。 超限时 AgentTool 返回 tool error(防模型在子 agent prompt 中写“用 AgentTool“ 导致无限递归)。默认 3。设 0 禁用 AgentTool。

§verbose_tool_results: bool

是否保留完整工具结果文本。默认 false —— 工具结果会被截断到 2KB 再送回给模型。设 true 时原样透传(长输出场景可能显著消耗 context)。

§path_style: PathStyle

See PathStyle; mirrors Settings.path_style.

§deferred_tools: Arc<HashSet<String>>

Tools advertised to the model by name and description only, their schema fetched through ToolSearch — the scene’s ToolSurface::deferred, fixed when the session is built. A property of the session rather than of the tool, so an MCP tool that arrives mid-session is deferred like one that was there from the start.

§tool_results: ToolResultLimits

Where a tool result too long for the conversation is kept.

§model_autonomy: ModelAutonomy

What the model may set going for itself beyond the turn it is asked in.

Implementations§

Source§

impl EngineConfig

Source

pub fn defaults_for(model: impl Into<String>) -> Self

合理默认值;具体使用方根据 CLI 与 settings 覆盖。

Trait Implementations§

Source§

impl Clone for EngineConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EngineConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more