pub struct YoAgentStateAdapter<S: EventStore> { /* private fields */ }Implementations§
Source§impl<S: EventStore> YoAgentStateAdapter<S>
impl<S: EventStore> YoAgentStateAdapter<S>
Sourcepub fn new(state: YoAgentState<S>, actor: ActorRef) -> Self
pub fn new(state: YoAgentState<S>, actor: ActorRef) -> Self
Examples found in repository?
examples/yoagent_integration.rs (line 11)
9async fn main() -> Result<(), Box<dyn std::error::Error>> {
10 let state = YoAgentState::load(MemoryEventStore::new()).await?;
11 let sink = YoAgentStateAdapter::new(state.clone(), ActorRef::agent("yoagent"));
12 let run_id = RunId::new("run_demo");
13
14 sink.on_run_started(YoAgentRunStarted {
15 run_id: run_id.clone(),
16 task: "Investigate retry timeout".to_string(),
17 metadata: json!({}),
18 })
19 .await?;
20 sink.on_model_called(YoAgentModelCalled {
21 run_id: run_id.clone(),
22 model: "example-model".to_string(),
23 prompt_summary: "Find likely retry failure cause".to_string(),
24 })
25 .await?;
26 sink.on_model_finished(YoAgentModelFinished {
27 run_id: run_id.clone(),
28 model: "example-model".to_string(),
29 output_summary: "Retry state appears scoped too narrowly".to_string(),
30 })
31 .await?;
32 sink.on_tool_called(YoAgentToolCalled {
33 run_id: run_id.clone(),
34 tool: "cargo test".to_string(),
35 input_summary: "tool_retry_survives_timeout".to_string(),
36 })
37 .await?;
38 sink.on_tool_finished(YoAgentToolFinished {
39 run_id: run_id.clone(),
40 tool: "cargo test".to_string(),
41 output_summary: "test passed".to_string(),
42 success: true,
43 })
44 .await?;
45 sink.on_run_finished(YoAgentRunFinished {
46 run_id,
47 outcome: "patch ready for review".to_string(),
48 metadata: json!({}),
49 })
50 .await?;
51
52 println!(
53 "{}",
54 serde_json::to_string_pretty(&state.store().scan().await?)?
55 );
56 Ok(())
57}Trait Implementations§
Source§impl<S: Clone + EventStore> Clone for YoAgentStateAdapter<S>
impl<S: Clone + EventStore> Clone for YoAgentStateAdapter<S>
Source§fn clone(&self) -> YoAgentStateAdapter<S>
fn clone(&self) -> YoAgentStateAdapter<S>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<S: Debug + EventStore> Debug for YoAgentStateAdapter<S>
impl<S: Debug + EventStore> Debug for YoAgentStateAdapter<S>
Source§impl<S: EventStore> YoAgentStateSink for YoAgentStateAdapter<S>
impl<S: EventStore> YoAgentStateSink for YoAgentStateAdapter<S>
fn on_run_started<'life0, 'async_trait>(
&'life0 self,
event: YoAgentRunStarted,
) -> Pin<Box<dyn Future<Output = Result<EventId, StateError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_run_finished<'life0, 'async_trait>(
&'life0 self,
event: YoAgentRunFinished,
) -> Pin<Box<dyn Future<Output = Result<EventId, StateError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_model_called<'life0, 'async_trait>(
&'life0 self,
event: YoAgentModelCalled,
) -> Pin<Box<dyn Future<Output = Result<EventId, StateError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_model_finished<'life0, 'async_trait>(
&'life0 self,
event: YoAgentModelFinished,
) -> Pin<Box<dyn Future<Output = Result<EventId, StateError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_tool_called<'life0, 'async_trait>(
&'life0 self,
event: YoAgentToolCalled,
) -> Pin<Box<dyn Future<Output = Result<EventId, StateError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn on_tool_finished<'life0, 'async_trait>(
&'life0 self,
event: YoAgentToolFinished,
) -> Pin<Box<dyn Future<Output = Result<EventId, StateError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl<S> !RefUnwindSafe for YoAgentStateAdapter<S>
impl<S> !UnwindSafe for YoAgentStateAdapter<S>
impl<S> Freeze for YoAgentStateAdapter<S>
impl<S> Send for YoAgentStateAdapter<S>
impl<S> Sync for YoAgentStateAdapter<S>
impl<S> Unpin for YoAgentStateAdapter<S>
impl<S> UnsafeUnpin for YoAgentStateAdapter<S>
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