pub struct BuiltAgent { /* private fields */ }Expand description
An agent that passed every build check, ready to run many times.
Cheap to clone and safe to share across tasks; each run gets its own
state, and in-memory checkpoints are dropped after the run.
Implementations§
Source§impl BuiltAgent
impl BuiltAgent
Sourcepub fn trace_path(&self) -> Option<&Path>
pub fn trace_path(&self) -> Option<&Path>
Returns the trace file this agent writes, one root span per run.
None when tracing is off or goes to a custom sink.
The file is created at build.
Sourcepub async fn run(&self, input: impl Into<Input>) -> Result<String, KitError>
pub async fn run(&self, input: impl Into<Input>) -> Result<String, KitError>
Runs the agent once on input and returns the answer as text.
Retries transient provider failures; fails with Failed,
Paused or Retries when the run ends without an answer.
Sourcepub async fn run_with(
&self,
input: impl Into<Input>,
) -> Result<RunOutcome, KitError>
pub async fn run_with( &self, input: impl Into<Input>, ) -> Result<RunOutcome, KitError>
Runs the agent once on input and returns the full outcome.
Same failures as run.
The run id in the outcome works with resume.
Sourcepub async fn resume(&self, run_id: RunId) -> Result<String, KitError>
pub async fn resume(&self, run_id: RunId) -> Result<String, KitError>
Continues run run_id from its latest checkpoint, after a crash
or restart, and returns the answer. A finished run returns its
answer again. Needs Storage::sqlite(..) or Storage::custom(..).