pub struct Agent { /* private fields */ }Expand description
The unified agent. Holds the model client, memo store, sandbox, and a
shared handle to the currently-served ActiveHarness (which may be
hot-swapped by a self-improvement loop).
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn with_harness(
config: AgentConfig,
model: Box<dyn ModelClient>,
memo: Arc<dyn MemoStore>,
harness: Arc<ActiveHarness>,
) -> Result<Self, CoreError>
pub fn with_harness( config: AgentConfig, model: Box<dyn ModelClient>, memo: Arc<dyn MemoStore>, harness: Arc<ActiveHarness>, ) -> Result<Self, CoreError>
Build with an explicit model client (e.g. StubModel or [OpenAiModel])
and a shared, hot-swappable harness handle.
Sourcepub fn with_model(
config: AgentConfig,
model: Box<dyn ModelClient>,
memo: Arc<dyn MemoStore>,
) -> Result<Self, CoreError>
pub fn with_model( config: AgentConfig, model: Box<dyn ModelClient>, memo: Arc<dyn MemoStore>, ) -> Result<Self, CoreError>
Build with an explicit model client (e.g. StubModel or [OpenAiModel]).
A baseline harness is generated from the config’s agent name.
Sourcepub fn new(
config: AgentConfig,
memo: Arc<dyn MemoStore>,
) -> Result<Self, CoreError>
pub fn new( config: AgentConfig, memo: Arc<dyn MemoStore>, ) -> Result<Self, CoreError>
Build using the default model (stub unless openai feature is on).
pub fn session(&self) -> &str
Sourcepub fn harness(&self) -> Arc<ActiveHarness> ⓘ
pub fn harness(&self) -> Arc<ActiveHarness> ⓘ
Shared harness handle — hot-swappable by a self-improvement loop.
Sourcepub fn memo(&self) -> Arc<dyn MemoStore> ⓘ
pub fn memo(&self) -> Arc<dyn MemoStore> ⓘ
Shared memo store (used by the SDK to expose Session).
Sourcepub async fn run(&self, input: &str) -> Result<String, CoreError>
pub async fn run(&self, input: &str) -> Result<String, CoreError>
Run one turn. Injects memo context, calls the model, persists both turns.
Sourcepub async fn exec_tool(&self, command: &[String]) -> Result<String, CoreError>
pub async fn exec_tool(&self, command: &[String]) -> Result<String, CoreError>
Run a shell command inside the sandbox and remember the result.
Sourcepub async fn run_stream(
&self,
input: &str,
) -> Result<BoxStream<'static, Result<String, CoreError>>, CoreError>
pub async fn run_stream( &self, input: &str, ) -> Result<BoxStream<'static, Result<String, CoreError>>, CoreError>
Stream one turn token-by-token. Mirrors Agent::run for the memo
contract (recall before / persist both turns after) but emits model
tokens as they arrive. The returned stream is 'static and owns its
memo handle and model client, so the Agent may be dropped.