Skip to main content

AssistantConfig

Struct AssistantConfig 

Source
pub struct AssistantConfig {
Show 16 fields pub model: Option<String>, pub strict_model: bool, pub max_turns: u32, pub tools: Vec<Value>, pub gated_tools: Vec<String>, pub approval_policy: Option<ApprovalPolicyFn>, pub proactive_memory: Option<Arc<MemoryTools>>, pub tool_memory: Option<Arc<ToolMemory>>, pub tool_labels: Option<HashMap<String, ToolLabels>>, pub todos: Option<Arc<Mutex<TodoList>>>, pub value_store_previews: bool, pub response_format: Option<ResponseFormat>, pub context_window_override: Option<usize>, pub refuse_unadvertised_tools: bool, pub response_format_validator: Option<ResponseFormatValidator>, pub delegate_budget: Option<DelegateBudget>,
}
Expand description

Static configuration for a loop run.

Fields§

§model: Option<String>

Model id, or None to let the router choose (pin a tool-capable model for real tool use — the local completion path ignores tools).

§strict_model: bool

Fail on the selected model rather than silently substituting another. Native chat enables this only for an explicit per-turn selection.

§max_turns: u32

Hard cap on loop turns.

§tools: Vec<Value>

The model-visible tool list (from GeneralExecutor::all_tool_defs()).

§gated_tools: Vec<String>

Tool names that require human approval before running (the standing tier doesn’t auto-allow them, e.g. writes/shell on the local host without --full-access). Empty when the tier auto-allows everything.

§approval_policy: Option<ApprovalPolicyFn>

Optional per-agent approval policy. Given a tool name + params, returns whether to allow, require approval, or deny — the runtime enforcement of the agent_permissions.* posture for the running agent. When set it takes precedence over gated_tools; when None, gated_tools (the standing-tier list) applies, so existing callers are unchanged.

§proactive_memory: Option<Arc<MemoryTools>>

Host-side proactive memory bank for the assistant loop. When present, CAR runs a deterministic memory-maintenance + selective-intervention pass before each model turn, so long-running agents do not depend on the model remembering to call recall at the right time.

§tool_memory: Option<Arc<ToolMemory>>

Durable learned tool repairs. When present, the loop recalls what recovered this kind of tool failure last time, and records what recovers one this time — the difference between an agent that remembers and one that gets better (see super::tool_memory).

None disables both halves. A surface that must be reproducible — the benchmark harness above all — leaves it unset deliberately: a run whose prompt depends on what the operator’s assistant learned last Tuesday is not a measurement.

§tool_labels: Option<HashMap<String, ToolLabels>>

Information-flow tool labels used to classify whether a tool result came from outside the trust boundary (car#723).

None falls back to car_engine::builtin_tool_labels, so the network-reaching commodity tools are always classified even when a caller supplies nothing. Deliberately Option<_> rather than a plain map with a Default: an empty map would silently classify everything as internal, and a security marking that a forgotten field can switch off is not one. Callers that load .car/tool-labels.json should pass the merged map so a project’s own trust: untrusted declarations are honoured here too.

§todos: Option<Arc<Mutex<TodoList>>>

The run’s task list, rendered into a per-turn state block at the tail of the request (Parslee-ai/car#814 items 2-3). None renders no block.

§value_store_previews: bool

Retain tool results for the run and put a typed bounded preview in the transcript, instead of destructively truncating (Parslee-ai/car#813).

Production call sites pass VALUE_STORE_PREVIEWS_DEFAULT, which is false because the measured A/B did not meet #813’s fewer-model-calls criterion. See that constant for the results and caveats.

Still a field rather than a constant read inside the loop, because the bench needs both arms in one binary and a caller may want the old shape. With this false the observation path is byte-for-byte what it was: cap(), same cap, same notice.

Below OBSERVATION_CAP the two arms render identically — the flag can only change an observation that crosses the cap. Note the flag also gates SessionValues::resolve_refs on every tool call, so once a handle exists a later below-cap call whose argument is a $rN reference is rewritten on the on arm only. That is a no-op until something over the cap has been retained; it is not the same statement as “nothing below the cap can ever differ”.

§response_format: Option<ResponseFormat>

Constrain the run’s FINAL answer to JSON. Applies to the answer, not to the work: it is NOT sent on any turn that offers tools, because a JSON-constrained request suppresses tool use on real providers (GLM 5.3 Flash answered in one turn without a single tool call under json_object; the same goal unconstrained ran two delegations and two reads and got it right). The loop instead checks the final no-tool-call answer itself and, only if it is not the requested shape, re-asks ONCE with no tools and response_format set — see final_text_matches_format and the repair branch. A run that offers no tools at all has nothing to suppress and carries the format on every turn. A final answer that already parses costs no extra call.

None is the correct default for every caller that does not consume the answer as data. A knob that tightens the output contract, never a toggle between implementations (CLAUDE.md rule 1a). Provider-dependent: the Anthropic protocol rejects it up front (UnsupportedMode).

§context_window_override: Option<usize>

Override the context window (tokens) that bounds the running history each turn. None uses the registry’s window for model (0 when unknown, which disables compaction). Resolved through resolve_context_window, which clamps a value ABOVE a known registry window back down to it: compaction exists to stop provider-side truncation of the original task (see compact_history_to_window), and a window larger than the real one would recreate exactly that. A value below the registry window is honored as-is — it only tightens.

§refuse_unadvertised_tools: bool

Refuse any tool call whose name is not among tools with an error result, before approval or dispatch. Set on a delegate child so the tool subset it was granted holds at EXECUTION, not just advertisement: every tool is registered with the runtime, so a hallucinated call to an ungranted one would otherwise run (the same reason run_task’s GUI sub-agent enforces its restriction on the call, not the def).

false everywhere else, so existing callers whose advertised list is deliberately narrower than the registry keep today’s behavior.

§response_format_validator: Option<ResponseFormatValidator>

Validates a parsed final answer against the caller’s JSON Schema. Carried as a closure so car-server-core needs no schema-validation dependency: car-cli compiles the --json-schema file with the jsonschema crate it already has and passes Validator::is_valid here. Without it a JsonSchema format is parse-only in the loop — and since tool turns never carry the format on the wire, NOBODY would enforce the schema on a tool-bearing run. Ignored for JsonObject.

§delegate_budget: Option<DelegateBudget>

Run-level ceiling on delegate use. None applies DelegateBudget::default (20 delegations, 300 child turns); a call past either limit is an error result, never a spawn. Per parent run — children cannot delegate, so nothing nests under it.

Trait Implementations§

Source§

impl Clone for AssistantConfig

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

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

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

Source§

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

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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