pub struct AgentObservation {
pub observation_id: ObservationId,
pub agent_id: AgentId,
pub action_id: ActionId,
pub success: bool,
pub result: Option<Value>,
pub error: Option<String>,
pub duration_ms: i64,
pub tokens_used: Option<i32>,
pub cost_usd: Option<f64>,
pub timestamp: Timestamp,
pub belief_updates: Vec<BeliefId>,
pub learnings: Vec<Learning>,
}Expand description
An observation made by an agent after an action.
Fields§
§observation_id: ObservationIdUnique identifier for this observation
agent_id: AgentIdAgent that made the observation
action_id: ActionIdAction that led to this observation
success: boolWhether the action succeeded
result: Option<Value>Result data (JSON)
error: Option<String>Error message (if failed)
duration_ms: i64Duration in milliseconds
tokens_used: Option<i32>Tokens used (if applicable)
cost_usd: Option<f64>Cost in USD (if applicable)
timestamp: TimestampWhen this observation was made
belief_updates: Vec<BeliefId>Beliefs created/updated from this observation
learnings: Vec<Learning>Learnings extracted
Implementations§
Source§impl AgentObservation
impl AgentObservation
Sourcepub fn new(
agent_id: AgentId,
action_id: ActionId,
success: bool,
duration_ms: i64,
) -> Self
pub fn new( agent_id: AgentId, action_id: ActionId, success: bool, duration_ms: i64, ) -> Self
Create a new observation.
Sourcepub fn with_result(self, result: Value) -> Self
pub fn with_result(self, result: Value) -> Self
Set result.
Sourcepub fn with_error(self, error: impl Into<String>) -> Self
pub fn with_error(self, error: impl Into<String>) -> Self
Set error.
Sourcepub fn with_tokens(self, tokens: i32) -> Self
pub fn with_tokens(self, tokens: i32) -> Self
Set token usage.
Sourcepub fn add_belief_update(&mut self, belief_id: BeliefId)
pub fn add_belief_update(&mut self, belief_id: BeliefId)
Add belief update.
Sourcepub fn add_learning(&mut self, learning: Learning)
pub fn add_learning(&mut self, learning: Learning)
Add learning.
Trait Implementations§
Source§impl Clone for AgentObservation
impl Clone for AgentObservation
Source§fn clone(&self) -> AgentObservation
fn clone(&self) -> AgentObservation
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ComposeSchema for AgentObservation
impl ComposeSchema for AgentObservation
Source§impl Debug for AgentObservation
impl Debug for AgentObservation
Source§impl<'de> Deserialize<'de> for AgentObservation
impl<'de> Deserialize<'de> for AgentObservation
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for AgentObservation
impl PartialEq for AgentObservation
Source§impl Serialize for AgentObservation
impl Serialize for AgentObservation
Source§impl ToSchema for AgentObservation
impl ToSchema for AgentObservation
impl StructuralPartialEq for AgentObservation
Auto Trait Implementations§
impl Freeze for AgentObservation
impl RefUnwindSafe for AgentObservation
impl Send for AgentObservation
impl Sync for AgentObservation
impl Unpin for AgentObservation
impl UnwindSafe for AgentObservation
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
Mutably borrows from an owned value. Read more