Skip to main content

TurnHost

Struct TurnHost 

Source
#[non_exhaustive]
pub struct TurnHost<'a> { pub session_id: SessionId, pub definition: &'a AgentDefinition, pub environment: &'a AgentEnvironment, pub model: &'a ModelSpec, pub log: &'a dyn EventLog, pub history: &'a mut History, pub cancellation: CancellationToken, pub input: InputQueue, }
Expand description

Agent composition plus the session-specific resources for one turn.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§session_id: SessionId

Session being advanced.

§definition: &'a AgentDefinition

Valid behavioral definition being interpreted.

§environment: &'a AgentEnvironment

Shared execution resources.

§model: &'a ModelSpec

Effective model after per-turn controls.

§log: &'a dyn EventLog

Durable event storage.

§history: &'a mut History

Live projection of durable message history.

§cancellation: CancellationToken

Cooperative cancellation signal.

§input: InputQueue

Messages that arrived while this turn was running — see agentyk_core::input::InputQueue. Empty and inert unless the caller attached one.

Implementations§

Source§

impl<'a> TurnHost<'a>

Source

pub fn new( session_id: SessionId, definition: &'a AgentDefinition, environment: &'a AgentEnvironment, log: &'a dyn EventLog, history: &'a mut History, ) -> Self

Construct a host context using the agent’s default model.

Source

pub fn model(self, model: &'a ModelSpec) -> Self

Override the effective model for this turn.

Source

pub fn cancellation(self, token: CancellationToken) -> Self

Attach the cooperative cancellation signal.

Source

pub fn input(self, input: InputQueue) -> Self

Attach the queue a caller steers this turn through.

Source

pub async fn record( &mut self, turn_id: TurnId, effects: Vec<EventData>, ) -> Result<()>

Persist durable effects atomically, then advance projections and notify observers. Ephemeral effects bypass storage.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for TurnHost<'a>

§

impl<'a> !UnwindSafe for TurnHost<'a>

§

impl<'a> Freeze for TurnHost<'a>

§

impl<'a> Send for TurnHost<'a>

§

impl<'a> Sync for TurnHost<'a>

§

impl<'a> Unpin for TurnHost<'a>

§

impl<'a> UnsafeUnpin for TurnHost<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.