pub struct AgentReflection {
pub reflection_id: String,
pub attempt_summary: String,
pub failure_analysis: String,
pub corrective_strategy: String,
pub improvement_score: Option<f32>,
pub tags: Vec<String>,
pub outcome_signals: Vec<OutcomeSignal>,
pub session_id: String,
pub task_id: Option<String>,
pub timestamp: DateTime<Utc>,
}Expand description
A structured reflection generated after a suboptimal agent turn.
This is Gestura’s durable representation of ERL’s corrective reflection: a concise summary of the attempted action, the failure mode, and the strategy the agent should apply next time.
The runtime can:
- use it immediately for a same-turn retry,
- store it in session working memory as short-term corrective context, and
- promote it into
MemoryType::Reflectionfor retrieval in future turns.
Fields§
§reflection_id: StringStable identifier so downstream outcomes can update the same reflection.
attempt_summary: StringWhat the agent attempted.
failure_analysis: StringWhat went wrong or was suboptimal.
corrective_strategy: StringConcrete corrective strategy for future attempts.
improvement_score: Option<f32>Quality improvement score (0.0–1.0) — did the reflection help? Set after a subsequent attempt to measure improvement.
Tags for retrieval (tool names, error categories, task types).
outcome_signals: Vec<OutcomeSignal>Durable outcome signals linked back from retries, gates, and task outcomes.
session_id: StringSession context.
task_id: Option<String>Task ID if available.
timestamp: DateTime<Utc>When this reflection was created.
Implementations§
Source§impl AgentReflection
impl AgentReflection
Sourcepub fn new(
session_id: impl Into<String>,
attempt_summary: impl Into<String>,
failure_analysis: impl Into<String>,
corrective_strategy: impl Into<String>,
) -> Self
pub fn new( session_id: impl Into<String>, attempt_summary: impl Into<String>, failure_analysis: impl Into<String>, corrective_strategy: impl Into<String>, ) -> Self
Create a new reflection.
Attach tags for retrieval.
Sourcepub fn with_outcome_signals(self, outcome_signals: Vec<OutcomeSignal>) -> Self
pub fn with_outcome_signals(self, outcome_signals: Vec<OutcomeSignal>) -> Self
Attach durable outcome signals for corrective-learning provenance.
Sourcepub fn push_outcome_signal(&mut self, signal: OutcomeSignal)
pub fn push_outcome_signal(&mut self, signal: OutcomeSignal)
Record a single durable outcome signal.
Sourcepub fn promotion_confidence(&self) -> f32
pub fn promotion_confidence(&self) -> f32
Score how strongly this reflection should be promoted into durable memory.
Sourcepub fn to_prompt_section(&self) -> String
pub fn to_prompt_section(&self) -> String
Format as a prompt section for context injection.
Trait Implementations§
Source§impl Clone for AgentReflection
impl Clone for AgentReflection
Source§fn clone(&self) -> AgentReflection
fn clone(&self) -> AgentReflection
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AgentReflection
impl Debug for AgentReflection
Source§impl<'de> Deserialize<'de> for AgentReflection
impl<'de> Deserialize<'de> for AgentReflection
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for AgentReflection
impl RefUnwindSafe for AgentReflection
impl Send for AgentReflection
impl Sync for AgentReflection
impl Unpin for AgentReflection
impl UnsafeUnpin for AgentReflection
impl UnwindSafe for AgentReflection
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].