Skip to main content

CodeConfig

Struct CodeConfig 

Source
pub struct CodeConfig {
    pub default_model: Option<String>,
    pub providers: Vec<ProviderConfig>,
    pub storage_backend: StorageBackend,
    pub sessions_dir: Option<PathBuf>,
    pub storage_url: Option<String>,
    pub skill_dirs: Vec<PathBuf>,
    pub agent_dirs: Vec<PathBuf>,
    pub max_tool_rounds: Option<usize>,
    pub thinking_budget: Option<usize>,
    pub memory: Option<MemoryConfig>,
    pub queue: Option<SessionQueueConfig>,
    pub search: Option<SearchConfig>,
}
Expand description

Configuration for A3S Code

Fields§

§default_model: Option<String>

Default model in “provider/model” format (e.g., “anthropic/claude-sonnet-4-20250514”)

§providers: Vec<ProviderConfig>

Provider configurations

§storage_backend: StorageBackend

Session storage backend

§sessions_dir: Option<PathBuf>

Sessions directory (for file backend)

§storage_url: Option<String>

Connection URL for custom storage backend (e.g., “redis://localhost:6379”, “postgres://user:pass@localhost/a3s”)

§skill_dirs: Vec<PathBuf>

Directories to scan for skill files (*.md with tool definitions)

§agent_dirs: Vec<PathBuf>

Directories to scan for agent files (*.yaml or *.md)

§max_tool_rounds: Option<usize>

Maximum tool execution rounds per turn (default: 25)

§thinking_budget: Option<usize>

Thinking/reasoning budget in tokens

§memory: Option<MemoryConfig>

Memory system configuration

§queue: Option<SessionQueueConfig>

Queue configuration (a3s-lane integration)

§search: Option<SearchConfig>

Search configuration (a3s-search integration)

Implementations§

Source§

impl CodeConfig

Source

pub fn new() -> Self

Create a new empty configuration

Source

pub fn from_file(path: &Path) -> Result<Self>

Load configuration from an HCL file.

Only .hcl files are supported. JSON support has been removed.

Source

pub fn from_hcl(content: &str) -> Result<Self>

Parse configuration from an HCL string.

HCL attributes use snake_case which is converted to camelCase for serde deserialization. Repeated blocks (e.g., providers, models) are collected into JSON arrays.

Source

pub fn save_to_file(&self, path: &Path) -> Result<()>

Save configuration to a JSON file (used for persistence)

Note: This saves as JSON format. To use HCL format, manually create .hcl files.

Source

pub fn find_provider(&self, name: &str) -> Option<&ProviderConfig>

Find a provider by name

Source

pub fn default_provider_config(&self) -> Option<&ProviderConfig>

Get the default provider configuration (parsed from default_model “provider/model” format)

Source

pub fn default_model_config(&self) -> Option<(&ProviderConfig, &ModelConfig)>

Get the default model configuration (parsed from default_model “provider/model” format)

Source

pub fn default_llm_config(&self) -> Option<LlmConfig>

Get LlmConfig for the default provider and model

Returns None if default provider/model is not configured or API key is missing.

Source

pub fn llm_config( &self, provider_name: &str, model_id: &str, ) -> Option<LlmConfig>

Get LlmConfig for a specific provider and model

Returns None if provider/model is not found or API key is missing.

Source

pub fn list_models(&self) -> Vec<(&ProviderConfig, &ModelConfig)>

List all available models across all providers

Source

pub fn add_skill_dir(self, dir: impl Into<PathBuf>) -> Self

Add a skill directory

Source

pub fn add_agent_dir(self, dir: impl Into<PathBuf>) -> Self

Add an agent directory

Source

pub fn has_directories(&self) -> bool

Check if any directories are configured

Source

pub fn has_providers(&self) -> bool

Check if provider configuration is available

Trait Implementations§

Source§

impl Clone for CodeConfig

Source§

fn clone(&self) -> CodeConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for CodeConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for CodeConfig

Source§

fn default() -> CodeConfig

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for CodeConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for CodeConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> 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: 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: 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> 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> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,