Skip to main content

HeartbitConfig

Struct HeartbitConfig 

Source
pub struct HeartbitConfig {
Show 15 fields pub provider: ProviderConfig, pub orchestrator: OrchestratorConfig, pub agents: Vec<AgentConfig>, pub variables: HashMap<String, String>, pub restate: Option<RestateConfig>, pub telemetry: Option<TelemetryConfig>, pub memory: Option<MemoryConfig>, pub knowledge: Option<KnowledgeConfig>, pub permissions: Vec<PermissionRule>, pub lsp: Option<LspConfig>, pub daemon: Option<DaemonConfig>, pub workspace: Option<WorkspaceConfig>, pub guardrails: Option<GuardrailsConfig>, pub sandbox: Option<SandboxConfig>, pub personas: Vec<PersonaConfig>,
}
Expand description

Top-level configuration loaded from heartbit.toml.

Fields§

§provider: ProviderConfig

LLM provider selection and API key configuration.

§orchestrator: OrchestratorConfig

Orchestrator-level defaults applied to all sub-agents.

§agents: Vec<AgentConfig>

Per-agent configurations. Each entry defines one sub-agent.

§variables: HashMap<String, String>

Custom variables for template prompt substitution. Available as {var_name} in system_prompt, template prompts, and skill content.

§restate: Option<RestateConfig>

Restate durable workflow configuration.

§telemetry: Option<TelemetryConfig>

OpenTelemetry tracing configuration.

§memory: Option<MemoryConfig>

Persistent memory backend configuration.

§knowledge: Option<KnowledgeConfig>

Knowledge base (RAG) configuration.

§permissions: Vec<PermissionRule>

Declarative permission rules applied to all agents. Rules are evaluated in order — first match wins.

§lsp: Option<LspConfig>

Optional LSP integration for diagnostics after file-modifying tools.

§daemon: Option<DaemonConfig>

Daemon mode configuration for Kafka-backed long-running execution.

§workspace: Option<WorkspaceConfig>

Optional workspace configuration for agent home directories.

§guardrails: Option<GuardrailsConfig>

Guardrails configuration for injection detection, PII, and tool policies.

§sandbox: Option<SandboxConfig>

Application-layer filesystem sandbox. When set, restricts file access to allowed_dirs and blocks deny_globs. On Linux + sandbox feature, bash subprocess also gets Landlock enforcement.

§personas: Vec<PersonaConfig>

Persona instances declared in this config (Phase 0: parsed and lexically validated; the registry lookup happens at daemon startup once persona crates are loaded).

Implementations§

Source§

impl HeartbitConfig

Source

pub fn from_toml(content: &str) -> Result<Self, Error>

Parse a TOML string into a HeartbitConfig and validate it.

Returns Err(Error::Config) when the TOML is malformed or when a field violates an invariant (e.g. zero max_turns, missing provider when not running in cloud-delegated daemon mode, duplicate agent names).

§Example
use heartbit_core::config::HeartbitConfig;

let toml_text = r#"
[provider]
name = "anthropic"
model = "claude-sonnet-4-20250514"

[[agents]]
name = "assistant"
description = "A helpful general-purpose assistant."
system_prompt = "You are a helpful assistant."
max_turns = 10
max_tokens = 4096
"#;

let config = HeartbitConfig::from_toml(toml_text).expect("valid config");
assert_eq!(config.agents.len(), 1);
assert_eq!(config.agents[0].name, "assistant");
Source

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

Read and parse a TOML config file.

Trait Implementations§

Source§

impl Debug for HeartbitConfig

Source§

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

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

impl<'de> Deserialize<'de> for HeartbitConfig

Source§

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

Deserialize this value from the given Serde deserializer. 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> 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> 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, 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>,