pub struct ExperienceRecorder { /* private fields */ }Implementations§
Source§impl ExperienceRecorder
impl ExperienceRecorder
Sourcepub fn new(memory: Arc<dyn Memory>) -> Self
pub fn new(memory: Arc<dyn Memory>) -> Self
Build over any Memory backend (semantic for semantic recall).
Sourcepub fn from_store(store: ExperienceStore) -> Self
pub fn from_store(store: ExperienceStore) -> Self
Build from a pre-configured store (e.g. with a custom source/tag).
Sourcepub fn tool_trace_hook(&self) -> Arc<dyn Hook> ⓘ
pub fn tool_trace_hook(&self) -> Arc<dyn Hook> ⓘ
The hook that captures tool calls — install with AgentLoop::with_hook.
Sourcepub fn guide(&self) -> ExperienceGuide
pub fn guide(&self) -> ExperienceGuide
The guide that recalls + injects past experience — install with
AgentLoop::with_guide.
Sourcepub fn store(&self) -> &Arc<ExperienceStore> ⓘ
pub fn store(&self) -> &Arc<ExperienceStore> ⓘ
The shared store (for direct record/recall or reuse).
Sourcepub async fn record(
&self,
situation: impl Into<String>,
outcome: impl Into<String>,
)
pub async fn record( &self, situation: impl Into<String>, outcome: impl Into<String>, )
Record the just-finished run as an episode: situation + the tools the
trace captured (drained) + outcome. Call once after loop_.run.
Sourcepub async fn record_episode(&self, ep: Episode) -> Episode
pub async fn record_episode(&self, ep: Episode) -> Episode
Record a pre-built episode, filling tools from the trace when the
caller left them empty (and draining it either way, so the next run
starts clean).
Prefer this over record when you also know whether the
run succeeded and which skills it followed — those are the two fields
crate::experience::SkillDistiller and crate::experience::SkillReviser gate on, and
record has no way to express them:
recorder
.record_episode(
Episode::new(&task.description, outcome_text)
.with_success(outcome.is_ok())
.with_skills(skill_trace.drain()),
)
.await;Returns the episode as recorded — with tools filled in. The trace is
private and draining is one-shot, so a caller that also wants to hand
this run to crate::experience::SkillDistiller (whose gate counts tool calls) has
no other way to see what it did. Ignoring the return value is fine.