pub struct Agent {Show 33 fields
pub model: Model,
pub thinking_level: ThinkingLevel,
pub tools: ToolRegistry,
pub messages: Vec<Message>,
pub system_prompt: String,
pub cwd: PathBuf,
pub max_tokens: Option<u32>,
pub role: Option<Role>,
pub hooks: HookRunner,
pub api_key: String,
pub auth_store: Option<Arc<Mutex<AuthStore>>>,
pub ui: Arc<dyn UserInterface>,
pub context_config: ContextConfig,
pub retry_policy: RetryPolicy,
pub mode: AgentMode,
pub has_mana_skill: bool,
pub has_mana_basics_skill: bool,
pub has_mana_delegation_skill: bool,
pub guardrail_config: GuardrailConfig,
pub guardrail_profile: Option<GuardrailProfile>,
pub lua_tool_loader: Option<LuaToolLoader>,
pub file_cache: Arc<FileCache>,
pub checkpoint_state: Arc<CheckpointState>,
pub file_tracker: Arc<Mutex<FileTracker>>,
pub anchor_store: Arc<AnchorStore>,
pub read_max_lines: usize,
pub cache_options: CacheOptions,
pub recovery_ledger: Arc<Mutex<RecoveryLedger>>,
pub continue_policy: ContinuePolicy,
pub config: Arc<Config>,
pub run_policy: RunPolicy,
pub verification_gates: Vec<VerificationGate>,
pub workflow_contract: WorkflowContract,
/* private fields */
}Expand description
The core agent — runs the ReAct loop (reason, act, observe).
Fields§
§model: Model§thinking_level: ThinkingLevel§tools: ToolRegistry§messages: Vec<Message>§system_prompt: String§cwd: PathBuf§max_tokens: Option<u32>§role: Option<Role>§hooks: HookRunner§api_key: String§auth_store: Option<Arc<Mutex<AuthStore>>>Optional auth store for automatic OAuth token refresh before LLM calls. Optional auth store for automatic OAuth token refresh before LLM calls.
ui: Arc<dyn UserInterface>§context_config: ContextConfigContext management thresholds (wired from Config via AgentBuilder).
retry_policy: RetryPolicyRetry policy for transient LLM stream failures.
mode: AgentModeActive agent mode — controls which tools are permitted.
has_mana_skill: boolWhether the legacy mana reference skill is available as an optional fallback.
has_mana_basics_skill: boolWhether the legacy mana-basics reference skill is available as an optional fallback.
has_mana_delegation_skill: boolWhether the legacy mana-delegation reference skill is available as an optional fallback.
guardrail_config: GuardrailConfigEngineering guardrails config.
guardrail_profile: Option<GuardrailProfile>Resolved guardrail profile (None = disabled).
lua_tool_loader: Option<LuaToolLoader>Cloneable Lua extension tool loader inherited from the session/builder.
file_cache: Arc<FileCache>In-session file content cache, shared across tool calls.
checkpoint_state: Arc<CheckpointState>Shared checkpoint/file-history state, used to capture destructive edit restore points.
file_tracker: Arc<Mutex<FileTracker>>Tracks which files have been read; used for staleness and unread-edit warnings.
anchor_store: Arc<AnchorStore>Session-local anchors emitted by read and consumed by anchored edit mode.
read_max_lines: usizeMax lines the read tool may return before truncating. 0 means unlimited.
cache_options: CacheOptionsCache options for LLM requests.
recovery_ledger: Arc<Mutex<RecoveryLedger>>In-memory recovery checkpoints for this run. Session persistence can seed this ledger later.
continue_policy: ContinuePolicyPolicy for imp-local visible auto-continuation after high-confidence turns.
config: Arc<Config>Resolved runtime config for tool-specific policy checks.
run_policy: RunPolicyPer-run tool/write policy layered on top of AgentMode.
verification_gates: Vec<VerificationGate>Verification gates declared for this run.
workflow_contract: WorkflowContractLightweight workflow contract for this agent run. Initially informational; future runtime layers use it for policy, verification, and evidence.
Implementations§
Source§impl Agent
impl Agent
pub fn new(model: Model, cwd: PathBuf) -> (Self, AgentHandle)
pub async fn emit_recovery_checkpoint(&self, checkpoint: RecoveryCheckpoint)
Auto Trait Implementations§
impl Freeze for Agent
impl !RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agent
impl !UnwindSafe for Agent
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> 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